How to make function arguments optional in Python

1 Answer

0 votes
def f(language, version, age = 0):
    print(language, version, age)

f("Python", "3")
f("Python", "2", 30)

 
 
 
'''
run:
 
Python 3 0
Python 2 30
 
'''

 



answered Apr 16, 2021 by avibootz

Related questions

...