-1

I have two lists with different values but same length, for example:

list1 = [0,1,2,3,4,5]
list2 = [6,7,8,9,10,11]

and I would like to use a for loop and iterate through both lists simultaneous so that the output would be

0,6
1,7
2,8
3,9
4,10
5,11

this obviously doesn't work:

for val1 in list 1 and val2 ind list2:
   print (val1, val2)

and this doesn't generate the output I would like to have:

for val1 in list 1: 
   for val2 in list2:
      print (val1, val2)

Can you guys please help me?

huschhusch
  • 17
  • 6

1 Answers1

-1

i assume that you have the same list length for list1 and list 2

in order to print it you just need to specify the position of the index on list like list[index], this will print the list value.

list1 = [0,1,2,3,4,5]
list2 = [6,7,8,9,10,11]

for i in range(len(list1)):
    print(f"{list1[i]}, {list2[i]}")