You've learned how to create dictionaries, read values by key, and add new keys. Time to practice.
You're given a small user record stored in a dict. Read a value out of it, then add a new key.
Your tasks
Start with this dict:
user = {"name": "Alice", "age": 30, "city": "Springfield"}
1. Print the value of the age key
2. Add a new key "country" with the value "USA" to the user dict
3. Print the value of the country key
Expected output
Constraints
- Access values with square brackets, e.g.
user["age"]
- Add the new key by assigning to it:
user["country"] = ...
- No external libraries