Python function parameters are divided into 3 main forms:
1. Position or keyword Parameters
2. Any number of positional parameters
3. Any number of keyword parameters
def fun7 (a,b,c): Print a,b,cfun7 (1,8,9) Fun7 (a= the, c= -, b= About) Fun7 (a="Soyo", c= -, b="Soyosoyo") def fun8 (str2,*num): Print"The string is:"+str2 Print"The numbers are:", NumreturnNUMQ=FUN8 ("Soyo5",1,2,6,8) forIinchq:print idef fun9 (STR3,*num1,**Kwargs): Print"str3="+STR3 Print"the numbers within the tuple are:", NUM1 print"The dictionary is:", KwargsreturnKWARGSA1=fun9 ("soyo100",1,5,9, name="Millet", value= the) Keys=A1.keys () print keys forIinchKeys:print A1[i]
Results:
1 8 9
89 99 70
Soyo Soyosoyo 100
The string is: Soyo5
Numbers are: (1, 2, 6, 8)
1
2
6
8
str3=soyo100
The numbers within the tuple are: (1, 5, 9)
The dictionary is: {' name ': ' \xe5\xb0\x8f\xe7\xb1\xb3 ', ' Value ': 88}
[' Name ', ' value ']
Millet
88
python--function parameter types