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
A. any number of
C. 1
D. 2
Answer: Option A
Solution (By Examveda Team)
The program defines a functionf
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