About 424,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 …

  2. What is the return value of the range () function in python?

    May 4, 2017 · In Python 2.x the range function actually returned a list that the for loop would iterate through. In Python 3.x, the range function is it's own type, and is actually a generator …

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

    My versions use the original range function to create multiplicative indices for the shift. This allows same syntax to the original range function. I have made two versions, one using float, and one …

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

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

  6. Alternate for range in python - Stack Overflow

    Oct 19, 2016 · If I have to generate natural numbers, I can use 'range' as follows: list (range (5)) [0, 1, 2, 3, 4] Is there any way to achieve this without using range function or ...

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

    Dec 6, 2015 · 7 I helped add the function to the package . more_itertools.numeric_range(start, stop, step) acts like the built in function range but can handle floats, Decimal, and Fraction types.

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

  9. string - Alphabet range in Python - Stack Overflow

    Jul 17, 2022 · 4 Print the Upper and Lower case alphabets in python using a built-in range function

  10. Python range function - Stack Overflow

    Say I want to loop from 0 to 100 but with a step of 1/2. If you try for i in range(0, 100, 0.5): whatever Error: the step must not be 0 Question: Is there any built-in way in Python 2.x to do