Answer to Question #309928 in Python for Kimberley Miller

Question #309928

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?


1
Expert's answer
2022-03-11T17:39:29-0500
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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS