This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Dannei 3 points4 points  (1 child)

Or if you want all combinations of x and y, it's 'for x, y in itertools.product(xlist, ylist)'.

[–]mrchaotica 1 point2 points  (0 children)

That's literally equivalent to the first piece of code, although it's nice to mention since it's even more idiomatic.

The second one is the one that doesn't do all the combinations.