My issue
Task
A dictionary has been defined for you in the IDE. You need to do the following
Add a new key as “location” and its value as “New York”
Update the “age” as 26
Print the updated dictionary to the console
My code
# Update the code below to get the necessart output
# Given dictionary
person = {
"name": "John",
"age": 25,
"city": "Seattle"
}
# Add a new key-value pair
person["location"] = "New York"
# Update the value of the "age" key
person["age"] = 26
# Print the updated dictionary
print(person)
Learning course: Python Programming
Problem Link: Modifying a dictionary in Python Programming