Ad
  • Default User Avatar
  • Default User Avatar

    @ISO497 no worries ;) and congrats on solving!

  • Custom User Avatar

    omg, i used a global variable to check if the puzzle was solved but forgot to reset it for an new puzzle!

    thank you very much!

  • Default User Avatar

    Thanks!

  • Default User Avatar

    Hi - as this is a quite "easy" 3 kyu, it's not fair to give you complete detailled explanation; but here is a hint to help you debug:

    currently in the example tests there is exactly 1 puzzle and 1 solution, and 1 test:

    test.assert_equals(sudoku(puzzle), solution, "Incorrect solution for the following puzzle: " + str(puzzle))

    What you should do is copy the exact puzzle and solution and test and rename them puzzle2 solution2 and therefore add the 2nd test:

    test.assert_equals(sudoku(puzzle2), solution2, "Incorrect solution for the following puzzle: " + str(puzzle2))

    You now have 2 tests, that are running on the "same" inputs, one after the other. You will notice that, despite both tests being identical, your code fails on the 2nd test. Up to you to find out why ;)

  • Custom User Avatar

    I got a solution as

    [[6, 1, 5, 7, 2, 4, 8, 3, 9],

    [4, 8, 7, 3, 9, 5, 1, 6, 2],

    [9, 2, 3, 1, 8, 6, 5, 7, 4],

    [5, 9, 8, 4, 3, 2, 7, 1, 6],

    [1, 3, 6, 8, 7, 9, 2, 4, 5],

    [2, 7, 4, 6, 5, 1, 9, 8, 3],

    [8, 4, 9, 5, 1, 3, 6, 2, 7],

    [7, 6, 2, 9, 4, 8, 3, 5, 1],

    [3, 5, 1, 2, 6, 7, 4, 9, 8]]

    but it reminded me that "Value is not what was expected"

    is there any problem with my solution? thx