*args :
It allows a function to receive any number of positional arguments.
Python
def add_numbers(*args): print(args) add_numbers(2, 3, 5) #output (2, 3, 5) **kwargs :
It allows a function to receive any number of keyword arguments.
Python
def display_details(**kwargs): print(kwargs) display_details(name="Rahul", age=22) #output {'name': 'Rahul', 'age': 22} Using it Together :
Python
def example(a, *args, **kwargs): print(a) print(args) print(kwargs) example(10, 20, 30, x=5, y=8) #output 10 (20, 30) {'x': 5, 'y': 8}