sudoku[i][j] is returning 9 and your test array is acessible with a number between 0 and 8 (9 elements). The problem is that you want to do test[9] and you can only go to test[8]
Comment has been collapsed.
1,387 Comments - Last post 1 hour ago by star4you
18 Comments - Last post 2 hours ago by Sardaukar
1 Comments - Last post 2 hours ago by devotee
53 Comments - Last post 4 hours ago by AwesomePossum50
37 Comments - Last post 5 hours ago by Ezel
111 Comments - Last post 7 hours ago by CRAZY463708
5 Comments - Last post 7 hours ago by VahidSlayerOfAll
29 Comments - Last post 12 minutes ago by 13ADxXxGAY
400 Comments - Last post 17 minutes ago by Vee79
100 Comments - Last post 1 hour ago by Kappaking
196 Comments - Last post 1 hour ago by ProV1
128 Comments - Last post 1 hour ago by ceeexo
26,463 Comments - Last post 2 hours ago by marilynhanson
347 Comments - Last post 4 hours ago by Furty
Hi, yeah i know this isn't place for this, but i'm not sure where else i could post it so i might as well give it a shot.
i'm writing a python code that checks if sudoku is solved correctly, and i have problems at the very start. I have this so far
def testsudoku(sudoku):
sudoku=[[2,9,5,3,1,6,8,4,7], [3,4,8,7,9,2,6,1,5], [6,7,1,5,4,8,9,2,3], [5,6,3,2,8,9,1,7,4], [1,8,7,6,3,4,2,5,9], [4,2,9,1,5,7,3,6,8], [7,3,6,8,2,5,4,9,1], [8,5,4,9,6,1,7,3,2], [9,1,2,4,7,3,5,8,6]]
testsudoku(sudoku)
I get an error in line test[sudoku[i][j]]+=1 saying IndexError: list index out of range. If i write the same thing with numbers and not i and j it works fine and since range(9) returns numbers from 0 to 8 it should also be ok. I'm not quite sure what the problem is but i'd appreciate help.
Comment has been collapsed.