You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defpersninfo(name, job):
print("\nMy name is "+name+". ")
print(" and I am a(n) "+job+". ")
persninfo("ftnfanb", "429 TA")
Creating a Function with default value
defpersninfo(name, job="developer"):
print("\nMy name is "+name+". ")
print(" and I am a(n) "+job+". ")
persninfo("ftnfanb")
Using a keyword argument
defpetsAndInfo(name, numOfPets):
print("My name is "+name+" and I have "+numOfPets+" pet(s).")
Making the argument optional
defpetsAndInfo(name, numOfPets=None):
print("My name is "+name)
if(numOfPets):
print(" and I have "+numOfPets+" pet(s).")
petsAndInfo("Bob", str(5))
petsAndInfo("Tracy")