Looks at default formal parameters and how they can be used with keyword and positional arguments.
Пікірлер: 8
@gloriousnoobs54567 жыл бұрын
this is absolutely fantastic the most clear explanation I've found on YT so far thank you
@vlyalcin6 жыл бұрын
This is exactly what I was looking for. Great video!
@SMajid--SMajid8 жыл бұрын
This is such a neat explanation, thanks a lot!
@exabyte008 жыл бұрын
Thanks man!
@DarkLordAli958 жыл бұрын
THANKS!
@nasrullahturke44805 жыл бұрын
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.
@johnphilipjones5 жыл бұрын
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