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 = 'princeton',
field = 'physics')
print(user_profile)
In the user_profile
variable I am not allowed (by Python) to write 'location':'princeton'
and 'field': 'physics'
. That's the structure of key-value-pairs, isn't it? Why can't I then use it, but am submitted by the IDLE to use =
, and remove single-quotation marks which are in dictionaries used for assigning values.