Updating Dictionaries Exercise
Question 1 of 5
You have a user profile that needs to be updated with new information. Some fields might already exist:
profile = {'name': 'Alice', 'age': 25}
new_data = {'age': 26, 'email': 'alice@example.com', 'city': 'Boston'}Which method efficiently updates multiple fields at once?
profile.merge(new_data)
profile.update(new_data)
for key in new_data: profilekey = new_datakey
profile = profile + new_data