-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfunction_practrice.py
63 lines (50 loc) · 1.33 KB
/
function_practrice.py
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
54
55
56
57
58
59
60
61
def function1(arg1, arg2):
sum = arg2 + arg1
print(sum)
function1(10, 30)
def function2(*vals):
for elm in vals:
g = 0
x = ''
if type(elm) == int:
g = g + elm
print(g, end=' ')
elif type(elm) == str:
x = x + elm
print(x, end=' ')
function2(2,1,2,3,44)
function2('Bangladesh', 'is', 'a', 'prosperous', 'country')
print()
def function3(v1, v2, v3):
value = 'catch zebra '
value += v1
print(value)
function3(v1= 'mouly', v2 = 'in', v3 = 'danger')
def function4(**values):
for i in values:
print(i)
print(values[i])
print(values['s3']) #[] er vitore 'key' te '' dite hobe.
function4(s1 = 'We', s2 = 'want', s3 = '300', s4 = 'taka')
def function5(*args):
lst =[]
for x in args:
lst.append(x)
print(lst, end='')
#return(lst)
function5('Trust', 'me!','Practice', 'makes', 'a', 'person', 'perfect')
print()
#when we return:
def function6(*args):
lst =[]
for y in args:
lst.append(y)
return(lst)
print(function6('Trust', 'me!','Practice', 'makes', 'a', 'person', 'perfect'))
#see the difference:
def function7(*args):
lst =[]
for z in args:
lst.append(z)
return(lst)
print(function7('Trust', 'me!','Practice', 'makes', 'a', 'person', 'perfect'))