python kwargs

  1. Unpacking dictionaries
  2. Accepting arbitrary keyword arguments

def greet(first_name, last_name):
    print(f"Hello, {first_name} {last_name}!")


person = {"first_name": "John", "last_name": "Doe"}


# Unpacks the person dictionary 
# into the first_name and last_name arguments

greet(**person)


#Definition
def print_info(**kwargs):
    for key, value in kwargs.items():
        print(f"{key}: {value}")

# Can accept any number of keyword arguments
print_info(name="John Doe", age=30, country="USA")