1# A loop is used to iterate over a sequence
2# The format of a loop is
3for variable in object:
4 pass
5
6# A common use of a for loop is using the range() function
7for num in range(1, 10):
8 print(num)
9
10# It can also be used with a list
11new_list = ["Number 1", "Number 2", "Number 3", "Number 4"]
12for x in new_list:
13 print(x)
1l1 = [1, 2, 3]
2l2 = ['a', 'b', 'c']
3list(zip(l1, l2))
4#-> [(1, 'a'), (2, 'b'), (3, 'c')]
1>>> x = [1, 2, 3]
2>>> y = [4, 5, 6]
3>>> zipped = zip(x, y)
4>>> list(zipped)
5[(1, 4), (2, 5), (3, 6)]
6>>> x2, y2 = zip(*zip(x, y))
7>>> x == list(x2) and y == list(y2)
8True