Apr-24-2019, 08:50 AM
1. If you don't get NameError for xx then you have defined it somewhere outside the code you show to us.
2. You assign xx to a0 and then append xx to cc
3. In the code shown you never change xx - as a result you append same value of xx over and ove again.
4. On line 10 you reset cc in every iteration of the loop.
5. As a result of 3 and 4 cc has only one value always - original/initial value of xx that we know nothing about. So why cc is a list at all?
6. On line 12 you refer to cc[1][1], but as we see from 4 it has only 1 value so only c[0], i.e. 1 is invalid index for cc - that is why you get your error
7. given that you use cc[1][1], c[0][1], c[-1][-1] and the one and only element is cc is actually xx I would guess xx is a list with unknown number of elements (as we said multiple times in your code it is defined somewhere else, so we don't know about it)
2. You assign xx to a0 and then append xx to cc
3. In the code shown you never change xx - as a result you append same value of xx over and ove again.
4. On line 10 you reset cc in every iteration of the loop.
5. As a result of 3 and 4 cc has only one value always - original/initial value of xx that we know nothing about. So why cc is a list at all?
6. On line 12 you refer to cc[1][1], but as we see from 4 it has only 1 value so only c[0], i.e. 1 is invalid index for cc - that is why you get your error
7. given that you use cc[1][1], c[0][1], c[-1][-1] and the one and only element is cc is actually xx I would guess xx is a list with unknown number of elements (as we said multiple times in your code it is defined somewhere else, so we don't know about it)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs