Nevytiskne se cely slovnik,python
Napsal: 18 kvě 2020 20:21
Ahoj, podle ucebnice by se mel vytisknout cely slovnik, jde vam tohle prosim:
def build_profile(first, last, **user_info):
"""Build a dictionary containing everything we know about a user."""
profile = {}
profile['first_name'] = first
profile['last_name'] = last
for key, value in user_info.items():
profile[key] = value
return profile
user_profile = build_profile('albert', 'einstein', location='prince', field='math') # oznacene se nevytiskne
print(user_profile)
def build_profile(first, last, **user_info):
"""Build a dictionary containing everything we know about a user."""
profile = {}
profile['first_name'] = first
profile['last_name'] = last
for key, value in user_info.items():
profile[key] = value
return profile
user_profile = build_profile('albert', 'einstein', location='prince', field='math') # oznacene se nevytiskne
print(user_profile)