I Need To Call A Function Until It Returns 0 In Python
def solveMaze(win, board): mazesol.removeDeadEnds(win, board) I need to call mazesol.removeDeadends(win,board) until it returns 0. This is what the function does: This funct
Solution 1:
Is there something wrong with:
while mazesol.removeDeadends(win,board): pass
or
while mazesol.removeDeadends(win,board): print".",
or
a = 1
while a:
a = mazesol.removeDeadends(win,board)
print"Removed", a
Solution 2:
I think this is what you want:
while mazesol.removeDeadEnds(win, board) != 0:
pass
Solution 3:
fast and dirty
result= mazesol.removeDeadends(win,board)
while notresult:
result= mazesol.removeDeadends(win,board)
Solution 4:
You could do this with an infinite while loop that breaks if 0 is returned:
WhileTrue:
result = mazesol.removeDeadends(win,board)
if result == 0:
break
Post a Comment for "I Need To Call A Function Until It Returns 0 In Python"