Loops Concept Video Activity

Time: 10-15 minutes

Purpose: Give you practice with using for loops 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. Use a loop to make list2 have values that are one more than the values in list1 (i.e. list2 should be [2,3,4])
list1 = [1,2,3]
list2 = []
  1. use a loop to print out the numbers 1-5 multiplied by themselves (i.e. it should print out 1, 4, 9, 16, and 25)
  2. use list1 and list2 above and put the values of adding each of the items in those list together into a third list (i.e. list3 should be [3,5,7] since 1+2=3, 2+3=5 and 3+4=7) - use a loop and the zip function.
    list3 = []

Further learning resources:

A file showing a possible solution is available on github here