Problem Statement
What are *args and **kwargs used for?
Explanation
The *args parameter allows a function to receive any number of positional arguments as a tuple. It provides flexibility when you don’t know how many inputs will be passed.
The **kwargs parameter collects keyword arguments into a dictionary, letting you handle named parameters dynamically. Together they make Python functions highly extensible and are often used in wrappers and decorators.
Code Solution
SolutionRead Only
def demo(*a, **b): print(a,b)
