Computer 2

List Worksheet Answers

Use this to study for the quiz on lists.

  1. green
  2. popcorn
  3. [10, 99, 30, 40, 50]
  4. ["dog", "fish", "cat", "hamster"]
  5. 3
  6. Does not print first item. print(games[0])
  7. Uses add but should use append. sports.append("soccer")
  8. Use square brackets. numbers = [10, 20, 30]
  9. subjects = ["Math", "English", "Art", "Music"]
    print(subjects[1])
  10. animals = ["cat", "dog", "bird", "fish"]
    animals.append("eagle")
    animals[1] = "wolf"
    print(animals)
  11. for item in foods:
        print(item)
  12. grades = []
    grades.append(90)
    grades.append(85)
    grades.append(77)
    print(len(grades))
  13. You have a shield
    You have a armor
    You have a map
    You have a bow
  14. The index 4 is too big. To print the last score you can use: print(scores[-1])