I was reading about how to declare a matrices in python and I find this question How to define two-dimensional array in python
It's work with me, but I understanding what was done here in part, what I don't understanding is the parameter before the "for" in both loops...So I going to my terminal and testing parts of this for one by one, so when I type:
0 for x in range(w):
I receive:
File "< stdin >", line 1
So I try:
[0 for x in range(w)] for y in range(h):
receive:
File "< stdin >", line 1 [0 for x in range(w)] for y in range(h):
So I try:
[0 for x in range(w)]
and
[[0 for x in range(w)] for y in range(h)]
and it's work...
So why the loop works when I put the brackets and not work without the brackets?
Thanks in advance.