MENU
Question -

Write a program to illustrate тАЬdefault argumentтАЭ.



Answer -

#!/usr/bin/python
# Function definition is here
def printinfo(name,age=35):
тАЬThis prints a passed info into this functionтАЭ
print тАЬName: тАЬ,
name; print тАЬAge тАЬ,
age return;
# Now you can call printinfo function
printinfo(age=50,name=тАЭmikiтАЭ);
printinfo(name=тАЭmikiтАЭ);

When the above code is executed, it produces following result:

Name: miki
Age 50
Name:miki
Age 35

Comment(S)

Show all Coment

Leave a Comment

Free - Previous Years Question Papers
Any questions? Ask us!
×