Wednesday, August 6, 2014

Day 123

Python at CodeCademy. Worked on Python tutorial 5 of 14, Python Lists and Dictionaries: List Slicing! Worked on accessing a portion of a list..

The code used:
suitcase = ["sunglasses", "hat", "passport", "laptop", "suit", "shoes"]
first  = suitcase[0:2]  # The first and second items (index zero and one)
middle = suitcase[2:4]  # Third and fourth items (index two and three)
last   = suitcase[4:6]  # The last two items (index four and five)

There was no interaction for this code:

No comments:

Post a Comment