I was reading a tutorial and it had the following code:
- Code: Select all
# gives [(0, 0), (0, 1), (1, 0), (1, 1)]
[(x, y) for x in range(2) for y in range (2)]
Also, how can I print this list out onto the screen?
How does the counting work in this case? That's the bit I'm confused about. If somebody could walk through it step-by-step that would be great, thanks.