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
Nesta página do site você pode assistir ao vídeo on-line default arguments python duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Tarun Sir 14 Abril 2020, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 162 vezes e gostou 10 espectadores. Boa visualização!