Learn
Because dictionaries are mutable, they can be changed in many ways. Items can be removed from a dictionary with the del
command:
del dict_name[key_name]
will remove the key key_name
and its associated value from the dictionary.
A new value can be associated with a key by assigning a value to the key, like so:
dict_name[key] = new_value
Instructions
1.
Delete the 'Sloth'
and 'Bengal Tiger'
items from zoo_animals
using del
.
Set the value associated with 'Rockhopper Penguin'
to anything other than 'Arctic Exhibit'
.
Take this course for free
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.