60 Program to demonstrate function with default argument in Python

Program:

#2.Default arguments: providing default arguments values in function definition,

#if values not specified during fn call,then these r taken as default arguments

def display(name="john",result="fail"):  #in fn call if values are not specified then by default these values r taken

    print(name,result)

display("Ajay","pass")

display("miller")

display()


Output:

Program to demonstrate function with default argument in Python

Previous
Next Post »