Jul-23-2020, 05:40 PM
Hi,
I'm following this youtube code for a sudoku solver using python.
In the following piece
Thanks
I'm following this youtube code for a sudoku solver using python.
In the following piece
def possible(y,x,n): global grid for i in range(0,9): if grid[y][i] == n: return False for i in range(0,9): if grid[i][x] == n: return False """ [b]don't understand the following 2 lines[/b] """ x0 = (x//3)*3 y0 = (y//3)*3 for i in range(0,3): for j in range(0,3): if grid[y0+i][x0+j] == n : return False return TrueCould someone explain the 2 I don't understand. I understand from the context that it's connected to checking a 3 by 3 square, but I can't find an explanation for this code.
Thanks