Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 How to stop an infinite loop in spyder if it's currently running?
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.
Post the code so we can help
my code:
print('Please think of a number between 0 and 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':
    if x=='l':
        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.
Check here:

It looks like the focus has to be on the right window.
Craig "Ichabod" O'Brien -
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures


Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Question about running comparisons through loop from input value Sunioj 2 397 Oct-15-2019, 03:15 PM
Last Post: jefsummers
  How to stop a loop? beginner1996 2 818 Mar-08-2019, 08:17 AM
Last Post: perfringo
  Help with while loop creating an infinite loop. FWendeburg 3 698 Jan-30-2019, 08:28 PM
Last Post: FWendeburg
  Infinite loop/ only half working anclark686 5 1,397 Sep-09-2018, 07:31 AM
Last Post: buran
  Why is this giving me an infinite loop? wlsa 4 1,448 Jul-25-2018, 10:11 PM
Last Post: cyberpatje
  Another infinite loop wlsa 7 1,516 Jul-20-2018, 12:04 AM
Last Post: wlsa
  Infinite loop Truman 9 3,407 Jan-19-2018, 11:25 PM
Last Post: j.crater

Forum Jump:

Users browsing this thread: 1 Guest(s)