I don't quite get why the code I submitted was wrong. It works with the sample sudokus mentioned in the exercise, and it worked with the test cases I came up with. Feedback is appreciated!
Here's the code:
You can check the results yourself with either of those two commands:
I think it doesn't run when it's called from the grader since you have
If I try to run the code multiple times, since
I think you have your first example on the perils of global variables.
After you run check_sudoku on an incorrect sudoku, since then, the following calls to check_sudoku will return False though it is correct or not. For example:
Ups, the second time you call check_sudoku(correct) you get False. Why? Because of the global variable row that you did not reset to  before append new elements. Your row variable contains all the elements from previous function calls.
My humble suggestion:
Try to avoid global variables. You could have those variables as local variables inside each method instead.
answered 18 Mar '12, 16:32
I'm not saying it's a bug, but... suggestion here:
answered 18 Mar '12, 16:05