While trying to remember the correct syntax for list comprehensions I stumbled upon the following results, can anyone enlighten me as to what is going on here? >>> [[i,j] for i in range(3), for j in range(3)] [[[0, 1, 2], 0], [[0, 1, 2], 1], [[0, 1, 2], 2]] >>> [[i,j] for i in range(3), for j in range(3),] [[[0, 1, 2], [0, 1, 2]]] Here I finally got it right: >>> [[i,j] for i in range(3) for j in range(3)] [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1],[2,2]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4