Python List Exercises

From WLCS
Revision as of 08:18, 13 May 2010 by Admin (talk | contribs) (New page: == Objectives == * You will learn to create lists * You will learn to access elements (things) in a list * You will learn to traverse (walk through) a list using a loop == Resources == * ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Objectives

  • You will learn to create lists
  • You will learn to access elements (things) in a list
  • You will learn to traverse (walk through) a list using a loop

Resources

Directions

Create a file name ch9_yourLastName.py


  1. Create a list named wordList that contains the following words: "washington", "lee", "generals", "arlington", "virginia"
  2. Print out the first element in wordList
  3. Print out the length of the list by using len(wordList)
  4. Print out the last element in wordList by using wordList[len(wordList)-1]
  5. Print out the word "generals" in the list