ExamVeda
Login
Home
Introduction to Python
?

The following python program can work with . . . . . . . . parameters.
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 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.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.