def solver():
empty_cell = empty_square()
counter = 0
if not empty_cell:
return True
i,j = empty_cell[0],empty_cell[1]
for num in range(1,10):
counter += 1
if constraint_check(num,i,j):
sudoku[i][j] = num
if solver():
return True
else:
sudoku[i][j] = 0
return False
Given the code above, how would I implement a counter to count how many iterations the recursive part of the function makes? As can be seen in the code I have attempted something above but I was not able to retrieve this variable to print it out and record the number.