- Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path02kwargs.py
19 lines (15 loc) · 599 Bytes
/
02kwargs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
deffav_colors(**kwargs):
''' kwargs comes as a dictionary '''
print(kwargs)
forperson, colorinkwargs.items():
print(f"{person}'s favorite color is {color}")
fav_colors(sriju="red", faizu="yellow", kabir="black")
defspecial_greeting(**kwargs):
if"David"inkwargsandkwargs["David"] =="special":
return"You get a special greeting David"
elif"David"inkwargs:
returnf"{kwargs['David']} David"
return"Not sure who is this"
print(special_greeting(David='Hello'))
print(special_greeting(Bob='hey'))
print(special_greeting(David='special'))