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?
#1
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.
Quote
#2
Post the code so we can help
Quote
#3
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.
Quote
#4
Check here: https://github.com/spyder-ide/spyder/issues/1101

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

Quote

Top Page

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

Forum Jump:


Users browsing this thread: 1 Guest(s)