About 322,000 results
Open links in new tab
  1. Python loop to run for certain amount of seconds

    I have a while loop, and I want it to keep running through for 15 minutes. it is currently: while True: #blah blah blah (this runs through, and then restarts. I need it to continue doing this ...

  2. python: restarting a loop - Stack Overflow

    Jan 29, 2009 · Changing the index variable i from within the loop is unlikely to do what you expect. You may need to use a while loop instead, and control the incrementing of the loop variable …

  3. python - How to make program go back to the top of the code …

    Python has control flow statements instead of goto statements. One implementation of control flow is Python's while loop. You can give it a boolean condition (boolean values are either True …

  4. Python: How to keep repeating a program until a specific input is ...

    Every time I write a while loop where the variable that the condition checks is set inside the loop (so that you have to initialize that variable before the loop, like in your second example), it …

  5. How would I stop a while loop after n amount of time?

    Good point about about putting the timeout check in the while loop condition. As for the comment about time.sleep(), the code does no work so will be cycling through the loop as fast as it can …

  6. How can I make my program return to the beginning in Python?

    This means the loop will be executed as long as the value of the variable 'loop' remains 4. But since you assign 2 to loop, the condition is not satisfied, and control goes out of the loop. One …

  7. Python while loop inside while loop - Stack Overflow

    Mar 28, 2013 · You've forgotten to reset the value of num (and also even and odd) inside the outer while loop (before starting the while num < 100 loop). Second time in, it doesn't need to …

  8. python - How can I stop a While loop? - Stack Overflow

    You need to understand that the break statement in your example will exit the infinite loop you've created with while True. So when the break condition is True, the program will quit the infinite …

  9. python - Get a Try statement to loop around until correct value ...

    Feb 11, 2010 · The Errors and Exceptions section of the Python tutorial would be a good place to start with basic exception handling in Python. In general, exceptions are not ideal for your …

  10. Calculator Loop in Python - Stack Overflow

    Apr 20, 2016 · Need to add a loop to my calculator by giving the user an option to restart the calculator by putting the code in a while loop with the condition that the input from user should …

Refresh