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

    @ToolmakerSteve I disagree. I rarely use break in loops and when I encounter it in code that I maintain I find that the loop, most often, could have been written without it. The presented …

  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. How do I parallelize a simple Python loop? - Stack Overflow

    Mar 20, 2012 · I actually tried the code find out if the function processInput takes little time, then for-loops actually performs better. However, if your function processInput takes a long time to …

  4. Python: Continuing to next iteration in outer loop

    Python Enhancement Proposal (PEP) 3136 suggested adding these to Python but Guido rejected it: However, I'm rejecting it on the basis that code so complicated to require this feature is very …

  5. scope - Scoping in Python 'for' loops - Stack Overflow

    Sep 1, 2010 · For starters, if variables were local to loops, those loops would be useless for most real-world programming. In the current situation: # Sum the values 0..9 total = 0 for foo in …

  6. matplotlib - Use a loop to plot n charts Python - Stack Overflow

    I have a set of data that I load into python using a pandas dataframe. What I would like to do is create a loop that will print a plot for all the elements in their own frame, not all on one. My da...

  7. loops - Execute statement every N iterations in Python - Stack …

    Apr 11, 2011 · Our goal is to do one thing on every iteration and two things on every nth iteration. We are going through 100 iterations. m. Easy-to-understand attempt: Block A, minimal …

  8. loops - Python: How to keep repeating a program until a specific …

    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 …

  9. python - "For" loop first iteration - Stack Overflow

    Dec 18, 2009 · I think the first S.Lott solution is the best, but there's another choice if you're using a pretty recent python (>= 2.6 I think, since izip_longest doesn't seem available before that …

  10. for loop in Python - Stack Overflow

    In Python you generally have for in loops instead of general for loops like C/C++, but you can achieve the same thing with the following code. for k in range(1, c+1, 2): do something with k …