from time import sleep
def foo():
sleep(3)
return True
while True:
print('Running')
if foo() == True:
print('Finished.')
break
I want to keep printing "Running" but when foo
returns True
I want to print "Finished" (once) and break out of the loop.
I have tried the above but it prints "Running" just once and waits for foo
to finish executing and then continues.