Changing your mind


#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['Slot']
del zoo_animals['Bengal Tiger']

Your code here!

dict.zoo_animals['Rockhopper Penguin'] = "East Asia"

print zoo_animals

error is
Traceback (most recent call last):
File "python", line 16, in
AttributeError: type object 'dict' has no attribute 'zoo_animals'

help


#2

This is the line raising the exception. Remove dict. and it will work.


#4

thanks. it worked
:slight_smile:


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.