Sudoku solver, index error on j==9

Please check the code here: https://ide.codingblocks.com/#/s/18128
Python version 3.5
Run using idle
I don’t know why am getting this error : “if board[i][j]!=0: IndexError: list index out of range
I have already taken care if j==n. then move to next row. So why on j==9 is it giving an error?

After doing if j==n: sudoku(board,i+1,0,n), you need to return. So just add return inside the if j==n block

1 Like