About 762,000 results
Open links in new tab
  1. 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 …

  2. What is the purpose of the single underscore "_" variable in Python?

    May 5, 2011 · An unused variable is often hiding a bug/typo (e.g. set day but use dya in the next line). The pattern matching feature added in Python 3.10 elevated this usage from "convention" to …

  3. Example use of "continue" statement in Python? - Stack Overflow

    In the example above if I use break the interpreter will skip the loop. But with continue it only skips the if-elif statements and go directly to the next item of the loop.

  4. When to use "while" or "for" in Python - Stack Overflow

    Dec 27, 2022 · When I should use a while loop or a for loop in Python? It looks like people prefer using a for loop (for brevity?). Is there any specific situation which I should use one or the other? Is it a mat...

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

    Tested on Python 3.12 Here are twelve examples of how you can access the indices with their corresponding array's elements using for loops, while loops and some looping functions.

  6. python - How to find the maximum number in a list using a loop?

    Note: the above code is to pick up the max and min by using for loop, which can be commonly used in other programming languages as well. However, the max () and min () functions are the easiest way …

  7. Progress bar for a "for" loop in Python script - Stack Overflow

    Apr 6, 2017 · Closely related: Python Progress Bar. Not closing as duplicate only because this question specifies a for loop rather than a progress bar for arbitrary actions, and there are some for -loop …

  8. python - How can I use `return` to get back multiple values from a loop ...

    Jul 4, 2020 · This question has become a canonical duplicate target for questions about returning multiple values from code including a for loop. As such, I have edited it somewhat artificially, to make …

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

    Use the argument block=False only if you want to pop up all the plots together (this could be quite messy if you have a lot of plots). You can do this inside the loop_plot function or in a separate loop …

  10. python - "for loop" with two variables? - Stack Overflow

    Sep 6, 2013 · 8 "Python 3." Add 2 vars with for loop using zip and range; Returning a list. Note: Will only run till smallest range ends.