git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How can i stop this Infinite While Loop - Python


>   item = input()                                        
>   if item != -1:

If you try this in the REPL, you'll see that 'item' is a string. You're
trying to compare it to an integer, which will always fail.

The cheapest way to fix this is probably:

    if item != '-1':

Best,
G