Changing your mind...I cant spot my mistake!


#1

# key - animal_name : value - location 
zoo_animals = { 'Unicorn' : 'Cotton Candy House',
'Sloth' : 'Rainforest Exhibit',
'Bengal Tiger' : 'Jungle House',
'Atlantic Puffin' : 'Arctic Exhibit',
'Rockhopper Penguin' : 'Arctic Exhibit'}
# A dictionary (or list) declaration may break across multiple lines

# Removing the 'Unicorn' entry. (Unicorns are incredibly expensive.)
del zoo_animals['Unicorn']

del zoo_animals["Sloth", "Bengal Tiger"]# Your code here!
Zoo_animals["Jungle House"] = "Rockhopper Penguin"



print zoo_animals

#2

This is one thing that will raise a compiler error.


#3

key - animal_name : value - location

zoo_animals = { 'Unicorn' : 'Cotton Candy House',
'Sloth' : 'Rainforest Exhibit',
'Bengal Tiger' : 'Jungle House',
'Atlantic Puffin' : 'Arctic Exhibit',
'Rockhopper Penguin' : 'Arctic Exhibit'}

A dictionary (or list) declaration may break across multiple lines

Removing the 'Unicorn' entry. (Unicorns are incredibly expensive.)

del zoo_animals['Unicorn']

del zoo_animals["Sloth", "Bengal Tiger"]# Your code here!
zoo_animals['Rockhopper Penguin'] = "Artic Exhibit"

print zoo_animals

I have changed that but it still wont work!


#4

Didn't it say to use something other than "Arctic Exhibit"? That's it. Change Arctic to anything and then try printing it. Also don't use the two apostrophes just use the one and see if that helps too. 'Sloth'


#5

Let's look at the instructions for Lesson 12:

https://www.codecademy.com/en/courses/python-beginner-en-pwmb1/2/3

When 'Sloth' and 'Bengal Tiger' are combined, as in the above code sample, Python raises an error:

Traceback (most recent call last):
File "python", line 13, in
KeyError: ('Sloth', 'Bengal Tiger')

We should use two statements, instead:

del zoo_animals['Sloth']
del zoo_animals['Bengal Tiger']

And as @lacystrander mentions above, the instructions read,

Set the value associated with 'Rockhopper Penguin' to anything other than 'Arctic Exhibit'.

So we could make a simple change, to,

zoo_animals['Rockhopper Penguin'] = 'Antarctic Exhibit'