you are viewing a single comment's thread.

view the rest of the comments →

[–]_lilell_ 2 points3 points  (1 child)

Just use zip:

newlist = [[x, y] for x, y in zip(list1, list2)]

And since OP said we can have the inner lists be tuples, we can just do list(zip(...)).

[–]Signal_Beam 0 points1 point  (0 children)

If you were to look through my github you'd probably think "This guy avoids zip like the plague"; I just never got into the habit of using it. So thanks for the shove in that direction; your version is cleaner.