-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction.py
More file actions
53 lines (41 loc) · 1.12 KB
/
Copy pathfunction.py
File metadata and controls
53 lines (41 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#Practice
#function:
"""def printme(str):
"this prints a passed string into this function"
print(str)
return;
printme(str = "My string")"""
"""def printinfo(name, age):
"this prints a passed info into this function"
print ("Name: ", name)
print ("Age: ", age)
return;
printinfo(age=50, name="miki")"""
#default arguments:
"""def printinfo(name, age = 35):
"this prints a passed info into this function"
print ("Name: ", name)
print ("Age: ", age)
return;
printinfo(age=50, name="miki")
printinfo(name="miki")"""
#non-keyword variable argument:
"""def printinfo(arg1, *vartuple):
print(arg1)
for var in vartuple:
print(var)
return
print("Output is")
printinfo(10)
printinfo(70, 60, 50)"""
#Anonymus Functions
"""sum = lambda num1, num2: num1 + num2;
print("Value of total : ",sum(10,20))
print("Value of total : ",sum(20,20))"""
#Anonymus Functions
def sum(num1, num2):
total = num1 + num2
print("Inside the Function : ",(total))
return total
total = sum(10,20)
print("Outside the function : ",(total))