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

    1128 I need to emulate a do-while loop in a Python program. Unfortunately, the following straightforward code does not work:

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

    Jun 21, 2015 · A do-while (although it should be called until) is my greatest wish for Python.

  3. How do I make a 'for' loop in python run infinitely?

    Feb 17, 2026 · In Python, we know that while loops can run infinitely, but is there any way to make a for loop run infinitely? From my prior checking, I found a way to do so by importing the 'itertools' module, …

  4. python - How can I access the index value in a 'for' loop? - Stack …

    The fastest way to access indexes of list within loop in Python 3.7 is to use the enumerate method for small, medium and huge lists. Please see different approaches which can be used to iterate over list …

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

    Apr 23, 2018 · There is no do...while loop because there is no nice way to define one that fits in the statement: indented block pattern used by every other Python compound statement.

  6. for loop in Python - Stack Overflow

    60 You should also know that in Python, iterating over integer indices is bad style, and also slower than the alternative. If you just want to look at each of the items in a list or dict, loop directly through the …

  7. python - How to stop one or multiple for loop (s) - Stack Overflow

    129 Use break and continue to do this. Breaking nested loops can be done in Python using the following:

  8. python - How do I reverse a list or loop over it backwards? - Stack ...

    How do I iterate over a list in reverse in Python? See also: How can I get a reversed copy of a list (avoid a separate statement when chaining a method after .reverse)?

  9. How do I parallelize a simple Python loop? - Stack Overflow

    Mar 20, 2012 · This is probably a trivial question, but how do I parallelize the following loop in python? # setup output lists output1 = list() output2 = list() output3 = list() for j in range(0, 10): # calc

  10. python - for or while loop to do something n times - Stack Overflow

    Jul 15, 2013 · It is worth noting that in Python a for or while statement can have break, continue and else statements where: break - terminates the loop continue - moves on to the next time around the loop …