About 431,000 results
Open links in new tab
  1. iteration - How to loop backwards in python? - Stack Overflow

    I can think of some ways to do so in python (creating a list of range(1,n+1) and reverse it, using while and --i, ...) but I wondered if there's a more elegant way to do it.

  2. python - How to make for loop without iterator variable ... - Stack ...

    Is it possible to do following without the i? for i in range (some_number): # do something If you just want to do something N amount of times and don't need the iterator.

  3. python range and for loop understanding - Stack Overflow

    Mar 26, 2022 · 0 I am new to python / coding and looking to understanding the range function more and how it is used in conjunction with the "for" loop. So I know that the range function …

  4. How does the Python's range function work? - Stack Overflow

    In such cases you could re-think your design and use while loops, or create objects which implement the "lazy evaluation" semantics of a generator, or use the xrange() version of …

  5. python - How to make a list of odd numbers using range and …

    -4 I am trying to learn Python with Eric Matthes's Python Crash Course. In one section of "Try it yourself" I have the next task. Use the third argument of the range() function to make a list of …

  6. Print a list in reverse order with range ()? - Stack Overflow

    Sep 2, 2011 · Using "reversed" with python generator (assuming we ware talking of Python 3 range built-in) is just conceptually wrong and teaches wrong habits of not considering …

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

    for b in range(..): if some condition: # break the inner loop break else: # will be called if the previous loop did not end with a `break` continue # but here we end up right after breaking the …

  8. python - Iterate through List with range - Stack Overflow

    May 21, 2020 · Again, Python's for loops are "front-inclusive" and "end-exclusive" so you should start with the index of the last element (len(myList)-1) and end with the index of the first …

  9. Using Python for Excel to loop values in Excel-range

    Oct 29, 2024 · But I would like to use the new Python for Excel-feature for this. I have inserted the following simple Python-snippet into a PY ()-formula in B4, but it returns 0.

  10. python - Loop backwards using indices - Stack Overflow

    In Python 3, range behaves the same way as xrange does in 2.7. @hacksoi depends on the use case but let's say you're iterating backwards in a large buffer, let's say it's 10 MB, then creating …