1. What are optional function arguments & default values? Give an example.
2.Why should the required arguments appear before the optional arguments in a function definition?
A function argument is a comma-separated input inside the function. The default values are the values given to parameters in case no value is specified
def sum(n, m=1):
return n + m
sum(5)
In the above example 5 is an argument. m is already specifed as 1 is a default argument
Comments
Leave a comment