Lists and tuples Concept Video Activity

Time: 10-15 minutes

Purpose: Give you practice with using lists and tuples in python.

Introduction: Try to work out the following tasks in python and run them to make sure they do what you expect.

Tasks:

  1. append 6 to the end of this list
    list1 = [1,2,3,4,5]
  2. What is the index of the number 3 in list1?
  3. Sort this list
    list2 = ['b','d','c','e','a']
  4. Use slicing to get [2,3,4] out of this list
    list3 = [1,2,3,4,5]
  5. find the sum of all items in list 3. (Hint: look up sum() in the python documentation)
  6. what number is at index -1 in list3?

Further learning resources:

A file showing a possible solution is available on github here