How to iterate through two lists in parallel?
list1 = ['blue', 'red', 'blue', 'yellow', 'blue', 'red'] list2 = [5, 6, 8, 9, 7, 1] for x, y in zip(list1, list2): print(x, '-', y)
Output
blue - 5 red - 6 blue - 8 yellow - 9 blue - 7 red - 1
list1 = ['blue', 'red', 'blue', 'yellow', 'blue', 'red'] list2 = [5, 6, 8, 9, 7, 1] for x, y in zip(list1, list2): print(x, '-', y)
blue - 5 red - 6 blue - 8 yellow - 9 blue - 7 red - 1