Computer Science
Assertion. Non-default arguments cannot follow default arguments in a function call.
Reason. A function call can have different types of arguments.
Python Functions
2 Likes
Answer
(b)
Both Assertion and Reason are true but Reason is not the correct explanation of Assertion.
Explanation
In a function call, any parameter cannot have a default value unless all parameters appearing on its right have their default values. Hence, non-default arguments cannot follow default arguments in a function call. Python supports three types of formal arguments :
- Positional arguments
- Default arguments
- keyword arguments
Answered By
2 Likes
Related Questions
A local variable having the same name as that of a global variable, hides the global variable in its function.
Assertion. A function is a subprogram.
Reason. A function exists within a program and works within it when called.
Assertion. A parameter having a default in function header becomes optional in function call.
Reason. A function call may or may not have values for default arguments.
Assertion. A variable declared inside a function cannot be used outside it.
Reason. A variable created inside a function has a function scope.