About 191,000 results
Open links in new tab
  1. python - How to emulate a do-while loop? - Stack Overflow

    Here's a very simple way to emulate a do-while loop: condition = True while condition: # loop body here condition = test_loop_condition() # end of loop The key features of a do-while loop are …

  2. loops - Is there a "do ... until" in Python? - Stack Overflow

    Jun 21, 2015 · Python 2.7.3 $ python -mtimeit 'while 0:pass' 100000000 loops, best of 3: 0.0132 usec per loop $ python -mtimeit 'while False:pass' 10000000 loops, best of 3: 0.0538 usec per …

  3. Repeat-until or equivalent loop in Python - Stack Overflow

    Dec 15, 2017 · @Robin the confusion is a good illustration of the common confusion between while cond do {} and repeat {} until cond loops. A while loop continues as long as its condition …

  4. Why there is no do while loop in python - Stack Overflow

    Apr 23, 2018 · "Nor is there really any need to have such a construct, not when you can just do:" If you do that, and you then call "continue" somewhere in the while loop before the condition …

  5. python - How to count down in for loop? - Stack Overflow

    Mar 27, 2015 · When you really understand for-loop in python, I think its time we get back to business. Let's focus your problem. You want to use a DECREMENT for-loop in python. I …

  6. 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 …

  7. 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 …

  8. python - How to do while loops with multiple conditions - Stack …

    condition1 = False condition2 = False val = -1 #here is the function getstuff is not defined, i hope you define it before #calling it into while loop code while condition1 and condition2 is False and …

  9. python - Tkinter understanding mainloop - Stack Overflow

    Mar 20, 2015 · An infinite loop containing the method calls update_idletasks() and update() can act as a substitute for calling tk.mainloop(). Note that the whole while loop can be said to block …

  10. Efficient way of having a function only execute once in a loop

    Nov 5, 2010 · There are many ways to do what you want; however, do note that it is quite possible that —as described in the question— you don't have to call the function inside the loop. If you …

Refresh