Articles → Python → Default Function Arguments In Python
Default Function Arguments In Python
Scenario
def PersonInformation(name, address):
print ('person name is:', name)
print ('person address is:', address)
return
PersonInformation("gyan","India")
PersonInformation(address="india")
Default Function Argument
def PersonInformation(name='gyan', address=''):
print ('person name is:', name)
print ('person address is:', address)
return
PersonInformation(address="india")
Output
Using Default Function Arguments When The Number Of Parameters Is Not Known
def HelloWorld2(*allPeople):
for x in allPeople:
print ('Hello', x)
HelloWorld2("amit","sumit","Kiran")
Output