File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 1
1
def add (* args ):
2
2
"""
3
- This shows one use of * in Python: it indicates this function takes in non-key argument and a variable length of arguments
3
+ This shows one use of * in Python: it indicates this function takes in non-key argument and a
4
+ variable length of arguments
4
5
:param args:
5
6
:return:
6
7
"""
@@ -12,7 +13,8 @@ def add(*args):
12
13
13
14
def print_food (** kwargs ):
14
15
"""
15
- Here double asterisk( ** ) is also used as **kwargs, the double asterisks allow passing keyword argument.
16
+ Here double asterisk( ** ) is also used as **kwargs, the double asterisks allow passing
17
+ keyword argument.
16
18
This special symbol is used to pass a keyword arguments and variable-length argument list.
17
19
18
20
Keyword arguments (or named arguments) are values that, when passed into a function,
@@ -27,4 +29,4 @@ def print_food(**kwargs):
27
29
print (f"{ kwargs [items ]} is a { items } " )
28
30
29
31
30
- print (print_food (fruit = 'cherry' , vegetable = 'potato' , boy = 'srikrishna' ))
32
+ print (print_food (fruit = 'cherry' , vegetable = 'potato' , boy = 'srikrishna' ))
You can’t perform that action at this time.
0 commit comments