Suppose , we have to add additional information about user. So,how can we add a additional information when we need? With help of optional argument which has default value string. We will return a dictionary which come additional information about a user.
# creating a function
def build_person(fname,lname,
age=” ):
“”” Return a information
about a person “””
# storing dictionary in a variable
person ={
“first “:fname,
“last”:lname ,
}
# using if condition
# if this condition is true then
# age key add to dictionary.
if age:
person[“age”] = age
return person
>>>musicians = build_person(“vipul”,”kunwar”,19)
>>>print(musicians)
Output:{“first”:”vipul “,”last “:“kunwar “,age:19}

πππππΈπΈ!