Infinite loop


I ve made an infinite loop, how do I break it?

choice = raw_input('Enjoying the course? (y/n)')

while choice!='y' or choice!='n':  # Fill in the condition (before the colon)
    choice = raw_input("Sorry, I didn't catch that. Enter again: ")


well, if the user enters something valid, for example y, we get:

while false or true

false or true is true. What other operators do we know that is false when we have false and true?


I understand that this statement is always gonna keep inside the loop cause the or makes it that way. Maybe, I didn't make myself clear about my question.

What i meant is that once in the console within an infinite loop, is there a way to break it from there? I mean directly in the console, I didn't find any pause button for running the code.


No, there isn't. Some sites like have it (not sure how they achieved it), if you where to run on your computer in the command line you could send an interrupt signal. But here isn't such button the lessons

best you can do is reload the page


Thanks:smiley:, that is just what I did.
I wasn't sure it might be some controls. Would be great as improvement.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.