(bo)
| 119 | |
| 120 | |
| 121 | def solve(bo): |
| 122 | # searching for next empty solt |
| 123 | slot = next_empty(bo) |
| 124 | if not slot: |
| 125 | # return True if there is no empty slot |
| 126 | return True |
| 127 | else: |
| 128 | row, col = slot |
| 129 | # looping number 1 to 9 |
| 130 | for i in range(1, 10): |
| 131 | # check if the number is possible in this location |
| 132 | if possible(bo, (row, col), i): |
| 133 | # placing the number on the board |
| 134 | bo[row][col] = i |
| 135 | |
| 136 | # starting recursion |
| 137 | if solve(bo): |
| 138 | # returns True when the previous returned True |
| 139 | # This will only activate if the board is full |
| 140 | return True |
| 141 | |
| 142 | # resetting the changed value to 0 |
| 143 | bo[row][col] = 0 |
| 144 | return False |
| 145 | |
| 146 | |
| 147 | # Fill your numbers in the board below or create a new array to solve the board you give. |
no test coverage detected