Saturday, August 2, 2014

Day 119

Python at CodeCademy. Worked on Python tutorial 1 of 14, Python Lists and Dictionaries: Introduction to Lists! Intro to lists, added an item to an existing list.

The code used:
zoo_animals = ["pangolin", "cassowary", "sloth", "elephant", ];

if len(zoo_animals) > 3:
print "The first animal at the zoo is the " + zoo_animals[0]
print "The second animal at the zoo is the " + zoo_animals[1]
print "The third animal at the zoo is the " + zoo_animals[2]
print "The fourth animal at the zoo is the " + zoo_animals[3]

The interaction for this code:
The first animal at the zoo is the pangolin
The second animal at the zoo is the cassowary
The third animal at the zoo is the sloth
The fourth animal at the zoo is the elephant

No comments:

Post a Comment