Difference between revisions of "Python List Exercises"
From WLCS
(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 == * ...) |
(→Directions) |
||
Line 8: | Line 8: | ||
== Directions == | == Directions == | ||
− | Create a file name ch9_yourLastName.py | + | Create a file name "ch9_yourLastName.py". In your file, complete the following exercises: |
Revision as of 08:18, 13 May 2010
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". In your file, complete the following exercises:
- Create a list named wordList that contains the following words: "washington", "lee", "generals", "arlington", "virginia"
- Print out the first element in wordList
- Print out the length of the list by using len(wordList)
- Print out the last element in wordList by using wordList[len(wordList)-1]
- Print out the word "generals" in the list