Q. Consider the following code. Identify the types and values of arguments being passed for each function call.
def func( a, b = 5, c = 10):
poly = 2 * a ** 2 - 5 * b + c
print("With values", a, b, c)
print(poly)
func(3, 7) # function call 1
func(25, c = 24) # function call 2
func(c = 50, a = 100) # function call 3
Types of arguments: | Types of arguments: | Types of arguments: | |
---|---|---|---|
Function call 1 | a gets | b gets | c gets |
Function call 2 | a gets | b gets | c gets |
Function call 3 | a gets | b gets | c gets |
Answer :-
Output :-
With values 3 7 10
-7
With values 25 5 24
1249
With values 100 5 50
20025
>>>
-7
With values 25 5 24
1249
With values 100 5 50
20025
>>>
Types of arguments: | Types of arguments: | Types of arguments: | |
---|---|---|---|
Function call 1 | a gets 3 | b gets 7 | c gets 10 |
Function call 2 | a gets 25 | b gets 5 | c gets 24 |
Function call 3 | a gets 100 | b gets 5 | c gets 50 |
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )