I want to make a while loop that runs indefinitely until a condition is true. The problem is when the condition isn't true the loop only runs for around two minutes and then breaks return the following error: RecursionError: maximum recursion depth exceeded in comparison
I have tried both of the following loops:
def loop():
list = ['Lorem ipsum']
n = 10
list_length = len(list)
while True:
len(list) != n
if len(list) == n:
print('Lorem ipsum')
#This when I want to call main() and keep the loop running
main()
else:
#I here make a call to another function
def Lorem ipsum()
#Or break out of the loop and run some code and return something
break
print('Lorem ipsum')
return list_length
def loop():
list = ['Lorem ipsum']
n = 10
list_length = len(list)
if list_length != n:
print('Lorem ipsum')
return list_length
else:
print('Lorem ipsum')
main()
Aucun commentaire:
Enregistrer un commentaire