Post

Sergei Kotov
Sergei Kotov@kotov_dev·
@PythonPr Answer: 3 5 20 › a=3 -- set positionally › b -- nobody passed it, so it stays at default 5 › c=20 -- keyword arg jumps over b and overrides c only For beginners: keyword args let you override any default by name without touching the others.
English
0
0
3
153
Earnest Codes
Earnest Codes@Earnesto037·
@PythonPr Answer: 3 5 20 The quiz tests how Python handles positional and keyword arguments alongside default values: def fun(a, b=5, c=10):: This defines a function where a is a required positional argument, while b and c have default values of 5 and 10, respectively.
English
1
0
3
193
TechGuideHub
TechGuideHub@TechGuideHub·
@PythonPr fun(3, c=20) calls the function with: a = 3 # provided positionally b = 5 # default value, because no b was provided c = 20 # keyword argument overrides default c=10 So print(a, b, c) outputs: 3 5 20
English
0
0
1
36
Paylaş