The Power of ** for Dictionaries in Python


Unpack dictionaries into function arguments.

Source Code

info = {"name": "John", "age": 30}
def greet(name, age):
    print(f"Hello, {name}. You are {age} years old.")
greet(**info)
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments