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
In questa pagina del sito puoi guardare il video online default arguments python della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Tarun Sir 14 aprile 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 162 volte e gli è piaciuto 10 spettatori. Buona visione!