We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parentd21a653 commit29c6375Copy full SHA for 29c6375
FunctionIntroduction/src/findprime.py
@@ -30,8 +30,16 @@ def optional_arg_func(a, b=None, c=30):
30
print('a={}'.format(a))
31
print('b={}'.format(b))
32
print('c={}'.format(c))
33
-
34
+defarbitrary_list_arg_func_1(*args):
35
+print('*args: stands for list of optional arguments')
36
+print('Notice arbitrary arguments are passed as a tuple to the function. Thus, one can use it as a iterator.')
37
+print(args)
38
+
39
+defarbitrary_list_arg_func_2(a,b,c,*args):
40
41
+print(a,b,c,args)
42
43
defmain():
44
forninrange(1,20):
45
isprime(n)
@@ -40,5 +48,9 @@ def main():
48
optional_arg_func(n)# do not provide optional arguments
49
print()
50
optional_arg_func(n,30,50)# give optional arguments
51
+print()
52
+arbitrary_list_arg_func_1(1,2,3,4,5)
53
54
+arbitrary_list_arg_func_2(1,2,3,4,5,6,7)
55
56
if__name__=='__main__':main()