I was making notes of imp points from this videos and I just came across one point which I am not sure if we are missing in this video unless assumed to be self understood. When we have default arguments set and if we pass just one argument without using keyword then by default the argument passed will take the place of first argument. def multiple_display (message = 'default', times = 2): for I in range (times): print(message) multiple_display ('HELLO WORLD') Gives result as HELLO WORLD HELLO WORLD multiple_display (88) Gives result as 88 88 Have I understood correct John.
As well as passing by keyword, arguments can be passed by position. So the 88 argument is passed to the formal parameter message replacing the 'default' string in the definition of the function. The second formal parameter in the function definition still keeps the integer value of 2. So 88 is printed twice. Best wishes Phil
this is absolutely fantastic
the most clear explanation I've found on YT so far
thank you
This is exactly what I was looking for. Great video!
This is such a neat explanation, thanks a lot!
THANKS!
Thanks man!
I was making notes of imp points from this videos and I just came across one point which I am not sure if we are missing in this video unless assumed to be self understood.
When we have default arguments set and if we pass just one argument without using keyword then by default the argument passed will take the place of first argument.
def multiple_display (message = 'default', times = 2):
for I in range (times):
print(message)
multiple_display ('HELLO WORLD')
Gives result as
HELLO WORLD
HELLO WORLD
multiple_display (88)
Gives result as
88
88
Have I understood correct John.
As well as passing by keyword, arguments can be passed by position. So the 88 argument is passed to the formal parameter message replacing the 'default' string in the definition of the function. The second formal parameter in the function definition still keeps the integer value of 2. So 88 is printed twice.
Best wishes
Phil
@@johnphilipjones Thanks Phil☺