Python Forum
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
2 Pairs 2 Lists
#7
list1 = [-1,3,8,2,9,5]
list2 = [4,1,2,10,5,20]

for e1, e2 in zip(list1, list2):
    print(e1, e2)
Output:
-1 4 3 1 8 2 2 10 9 5 5 20
Or if you want to make a new list from it:
list12 = list(zip(list1, list2))
If you require other results, then give us an example.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
2 Pairs 2 Lists - by Harshil - Aug-12-2020, 04:27 PM
RE: 2 Pairs 2 Lists - by DPaul - Aug-12-2020, 05:13 PM
RE: 2 Pairs 2 Lists - by Harshil - Aug-12-2020, 05:14 PM
RE: 2 Pairs 2 Lists - by DPaul - Aug-12-2020, 05:22 PM
RE: 2 Pairs 2 Lists - by Harshil - Aug-12-2020, 05:23 PM
RE: 2 Pairs 2 Lists - by DPaul - Aug-13-2020, 06:34 AM
RE: 2 Pairs 2 Lists - by DeaD_EyE - Aug-13-2020, 01:25 PM
RE: 2 Pairs 2 Lists - by deanhystad - Aug-13-2020, 02:32 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  how to find 'cycle' for key-value pairs in a dictionary? junnyfromthehood 1 3,735 Sep-29-2019, 01:07 AM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020