default arguments python

Published: 14 April 2020
on channel: Tarun Sir
162
10

In this video you will learn about default argument or default parameters in function in python.

What is Default Parameter Value/ Default Arguments
Python allows us to specify default value for parameters. The default value of parameter is used when we do not pass argument for that parameter. If a function defines default value for some of its parameters then those parameters must appear on right most side in definition.
In the following example we are defining a function greeting() which have parameter name having default value "Bhaarat". If we call the function greeting() without passing argument then it uses default value Bhaarat for parameter name.
def greeting(name="Bhaarat"):
print("Hello Dear",name)
greeting()#Prints Hello Dear Bhaarat
greeting("Khushal")#Prints Hello Dear Khushal


The parameters which have default value , are also called as optional argument.

#python_by_tarun_sir #tarun_sir #python #tarun_sir_python #python_video_44 #default_argument_in_python #python_tutorial #create_default_argument_function_in_python


On this page of the site you can watch the video online default arguments python with a duration of hours minute second in good quality, which was uploaded by the user Tarun Sir 14 April 2020, share the link with friends and acquaintances, this video has already been watched 162 times on youtube and it was liked by 10 viewers. Enjoy your viewing!