I am trying to define a two dimension array with for loops using range function:
>>> takobaba = [['A' for i in range(0, 6, 1)] for j in range(0, 6, 1)]
>>> takobaba [-1][-1]
'A'
As you can see i get an output for index -1, -1 even i called range function from 0 to 6 with step 1 for both dimensions. Could you please help me to understand the reason and fix this error?
No comments:
Post a Comment