About 53 results
Open links in new tab
  1. How to break out of while loop in Python? - Stack Overflow

    Jan 30, 2013 · Consider rephrasing "Don't use while True and break statements. It's bad programming." While I try to avoid them as a general rule, many times I have simplified logic …

  2. python - How to kill a while loop with a keystroke? - Stack Overflow

    Nov 1, 2012 · I am reading serial data and writing to a csv file using a while loop. I want the user to be able to kill the while loop once they feel they have collected enough data. while True: …

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

    I wrote a while loop in a function, but don't know how to stop it. When it doesn't meet its final condition, the loop just go for ever. How can I stop it? def determine_period(universe_array): ...

  4. python - How would I stop a while loop after n amount of time?

    how would I stop a while loop after 5 minutes if it does not achieve what I want it to achieve. while true: test = 0 if test == 5: break test = test - 1 This code throws me in an

  5. python - How can I break out of multiple loops? - Stack Overflow

    for b in range(20): if something(a, b): break # Break the inner loop... else: continue # Continue if the inner loop wasn't broken. break # Inner loop was broken, break the outer. This uses the for …

  6. python - ¿Dónde poner los break en un loop while True? - Stack …

    Jun 1, 2022 · El ciclo while se utiliza cuando se desea iterar sobre algo varias veces, hasta que la sentencia se vuelva False. En tu caso, al colocar While True terminas con un bucle infinito ya …

  7. python - While loops using break and continue statements - Stack …

    Jul 10, 2022 · I'm beginner. What is break and continue statement used for for a while statement? while: break continue

  8. python - break doesn't break while loop. why? - Stack Overflow

    Jan 16, 2021 · 1 The break always leaves the immediate loop construct, the "innermost". For your code that is the for loop, not the while loop which contains it.

  9. How to break while loop in an inner for loop in python?

    How to break while loop in an inner for loop in python? Asked 13 years, 1 month ago Modified 3 years, 8 months ago Viewed 28k times

  10. How to break a while loop after some minutes? - Stack Overflow

    1 I have a while loop in my python program and I want to break from this loop after 5 minutes, I'm currently using the following code: