python-crash-course/Chapter_08/8-13_user_profile.py
2025-02-21 14:41:04 +00:00

16 lines
610 B
Python

# Exercise 8-13 User Profile
# Learning Objective: Create a function that takes in two predefined key-value pairs and add 3 arbitrary ones.
# user_profile.py
def build_profile(first, last, **user_info):
"""Build a dictionary containing everything we know about a user."""
user_info['first_name'] = first
user_info['last_name'] = last
return user_info
user_profile = build_profile('mister', 'cheeks',
location='united states',
favorite_color='orange',
favorite_meal='scrambled eggs')
print(user_profile)