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