How to stop an infinite loop in spyder if it's currently running? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: How to stop an infinite loop in spyder if it's currently running? (/thread-11253.html) |
How to stop an infinite loop in spyder if it's currently running? - wlsa - Jun-30-2018 I'm stunned I haven't been able to find anything online about stopping a program you've run. The only thing I've been able to do so far is close spyder using a task manager and reopen it which is incredibly inefficient. One site did say try ctrl+c which didn't work. RE: How to stop an infinite loop in spyder if it's currently running? - Larz60+ - Jun-30-2018 Post the code so we can help RE: How to stop an infinite loop in spyder if it's currently running? - wlsa - Jun-30-2018 my code: print('Please think of a number between 0 and 100!') guess=50 lowguess=0 highguess=100 while True: print('is your secret number ' + str(guess) + '?') x=input("Enter 'h' to indicate the guess is too high. Enter 'l' to indicate the guess is too low. Enter 'c' to indicate I guessed correctly. ") if x=='c': print('Game over. Your secret number was: ' +str(guess)) if x=='h': guess+=-1 if x=='l': guess+=1 else: print("Sorry, I did not understand your input.")I figured out how to fix the code by adding a break after line 11. My primary question is how do I stop this code from running if I don't have a break on line 11? so far I've had to end it with a task manager and relaunch spyder. RE: How to stop an infinite loop in spyder if it's currently running? - ichabod801 - Jun-30-2018 Check here: https://github.com/spyder-ide/spyder/issues/1101 It looks like the focus has to be on the right window. |