About 50 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. 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 …

  3. Why does range(start, end) not include end? - Stack Overflow

    Basically in python range(n) iterates n times, which is of exclusive nature that is why it does not give last value when it is being printed, we can create a function which gives inclusive value it means it will …

  4. Python 3 turn range to a list - Stack Overflow

    Jul 14, 2012 · 275 I'm trying to make a list with numbers 1-1000 in it. Obviously this would be annoying to write/read, so I'm attempting to make a list with a range in it. In Python 2 it seems that: some_list = …

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

    Sep 2, 2011 · You don't necessarily need to use the range function, you can simply do list [::-1] which should return the list in reversed order swiftly, without using any additions.

  6. python - Does range () really create lists? - Stack Overflow

    In Python 2.x, if you want to get an iterable object, like in Python 3.x, you can use xrange function, which returns an immutable sequence of type xrange. Advantage of xrange over range in Python 2.x:

  7. Syntax for range function in Python - Stack Overflow

    Dec 9, 2022 · The range function in Python has the syntax range (start, stop, step) and generates a sequence of numbers starting from start, up to but not including stop, with a step size of step.

  8. 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)

  9. python - range () for floats - Stack Overflow

    Dec 6, 2015 · 7 I helped add the function numeric_range to the package more-itertools. more_itertools.numeric_range(start, stop, step) acts like the built in function range but can handle …

  10. Range function Python - Stack Overflow

    Nov 17, 2013 · range(b) returns a list of ints from 0 to b - 1, e.g., [0, 1, 2, 3, 4]. The for loop iterates over the list returned by range() and assigns the current value to i (you could call this whatever)