[Solved] Why does my while loop not stop? [closed]


Try this change:

RANDOM_COR=random.randrange(5,6)
COUNT = 0

def check_xy_data():                   

    global COUNT

With COUNT inside check_xy_data, you set it back to 0 on every call. It can never reach more than 1. Your check is whether it’s in the range 5-6. This is never true, so you can never leave the loop.

Note that trivial debugging skills would have found this: just stick a print statement before you test your loop condition, to see what the values are. Use that next time … 🙂

0

solved Why does my while loop not stop? [closed]