About 192,000 results
Open links in new tab
  1. How does the Python's range function work? - Stack Overflow

    The Python range() function simply returns or generates a list of integers from some lower bound (zero, by default) up to (but not including) some upper bound, possibly in increments (steps) of some other …

  2. iteration - How to loop backwards in python? - Stack Overflow

    I used range simply because the OP did. xrange vs range only matters for really large ranges, like hundreds of megabytes. Also, in Python 3.x, this distinction is gone.

  3. 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 memory/processing …

  4. 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 inner loop, so we …

  5. 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 takes in 3 …

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

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

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

    Note: Python (definitely not the CPython reference interpreter at least, probably not most of the others) does not optimize out tail recursion, so N will be limited to something in the neighborhood of the …

  9. Skip over a value in the range function in python - Stack Overflow

    What is the pythonic way of looping through a range of numbers and skipping over one value? For example, the range is from 0 to 100 and I would like to skip 50. Edit: Here's the code that I'm usi...

  10. python - How do I use a decimal step value for range ()? - Stack Overflow

    How do I iterate between 0 and 1 by a step of 0.1? This says that the step argument cannot be zero: for i in range(0, 1, 0.1): print(i)