?
The following python program can work with . . . . . . . . parameters.
The following python program can work with . . . . . . . . parameters.
def f(x):
def f1(*args, **kwargs):
print("Examveda")
return x(*args, **kwargs)
return f1
def f(x):
def f1(*args, **kwargs):
print("Examveda")
return x(*args, **kwargs)
return f1
Answer & Solution
Correct Answer:
Option
A
The program defines a function
Inside
The use of
Inside
Therefore, the program can work with any number of parameters.
f that takes another function x as an argument.Inside
f, there is a nested function f1 defined with variable-length arguments *args and keyword arguments **kwargs.The use of
*args allows f1 to accept any number of positional arguments, and **kwargs allows it to accept any number of keyword arguments.Inside
f1, "Examveda" is printed, and then the function x is called with the received arguments using (*args, **kwargs).Therefore, the program can work with any number of parameters.
Join the Discussion
Login to post a comment or share your explanation.
Login