Wednesday, August 13, 2014

Day 130

Python at CodeCademy. Worked on Python tutorial 12 of 14, Python Lists and Dictionaries: Changing Your Mind! Worked on changing dictionarys.

The code used:
# 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'}

del zoo_animals['Unicorn']

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

zoo_animals['Rockhopper Penguin'] = "Ice Exhibit"

print zoo_animals

The interaction for this code:
{'Atlantic Puffin': 'Arctic Exhibit', 'Rockhopper Penguin': 'Ice Exhibit'}

No comments:

Post a Comment