while result of a function is false call that function again in python

To call a function repeatedly until it returns False, you can use a while loop. Here's an example:

main.py
def my_function():
    # Some code...
    return False  # replace False with your condition

while my_function() is False:
    pass  # do nothing, just repeat the loop

# Code after the loop will be executed once the function returns True
239 chars
9 lines

In this example, my_function() is called repeatedly until it returns False. Once the function returns True, the loop will exit and the code after the loop will be executed.

related categories

gistlibby LogSnag