syntax is range(start, end, step). Example: range(0,100,10).

Here's the output as a list, using list(range(0,100,10))
[0, 10, 20, 30, 40, 50, 60, 70, 80, 90]

If you want it to reach 100, with stepsize=10, then add that to your range end, list(range(0,110,10)) gives
[0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]

Answer from HT. on Stack Overflow
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ ref_func_range.asp
Python range() Function
Python Examples Python Compiler ... default, and increments by 1 (by default), and stops before a specified number. range(start, stop, step) Create a sequence of numbers from 3 to 5, and print each item in the sequence: x = ...
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ gloss_python_for_range.asp
Python Looping Through a Range
The range() function defaults to increment the sequence by 1, however it is possible to specify the increment value by adding a third parameter: range(2, 30, 3): ... Python For Loops Tutorial For Loop Through a String For Break For Continue ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-range-function
Python range() function - GeeksforGeeks
Example: This example shows the use of range() to generate numbers starting from 0 up to (but not including) a given value. ... Example 1: This example generates numbers starting from a custom value and ending before another value. ... Example 2: This example generates even numbers by skipping values using a custom step size.
Published ย  March 10, 2026
๐ŸŒ
Stanford CS
cs.stanford.edu โ€บ people โ€บ nick โ€บ py โ€บ python-range.html
Python range() Function
Mnemonic: the "stop" number is strong, so as soon as the numbers hit or exceed the stop the range is done (even if the start number initiates things in that position). The 3 parameter form begins with start number, up to but no including the stop number as usual. The difference is the "step" amount between numbers is now custom.
๐ŸŒ
Python Examples
pythonexamples.org โ€บ python-range-with-steps
Python Range with step
Learn how to create a range in Python with a specified step value using the range() function. This tutorial covers the syntax and provides clear examples, demonstrating how to iterate through sequences with customizable step increments.
Find elsewhere
๐ŸŒ
Reddit
reddit.com โ€บ r/learnprogramming โ€บ question about pythons step option in range function?
r/learnprogramming on Reddit: Question about Pythons step option in Range function?
July 14, 2022 -

Say for example I have this code:

n = 10
i = 2
for j in range(i*i, n, i):
    print(j)

I see in my editor this prints: 4,6,8
My question is what is happening inside of range(i*i, n, i)?Does every iteration tack on +1?Like this:

for j in range(2*2, 10, 2)
for j in range(2*3, 10, 2)
for j in range(2*4, 10, 2)

But doesn't the step=2 ensure that it goes up in by steps of 2 each time like so:

for j in range(2*2, 10, 2)
for j in range(2*4, 10, 2)
for j in range(2*6, 10, 2)

Im confused on how the step part actually works.

๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-decimal-step-range-in-list
Python | Decimal step range in list - GeeksforGeeks
July 12, 2025 - One way to solve this problem is by using list comprehension which can solve this problem in an easier way by iterating the list and multiplying the range element to the index of the element. ... # initializing start value strt = 5 # initializing step value step = 0.4 # using list comprehension # Decimal step range test_list = [strt + (x * step) for x in range(0, 5)] # Printing result print("The list after decimal range\ value initialization : " + str(test_list))
๐ŸŒ
Mimo
mimo.org โ€บ glossary โ€บ python โ€บ range-function
Python range() Function [Python Tutorial]
Learn Python's range() function to generate sequences, control loops, and manage iterations. Explore start, stop, and step parameters with examples.
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ python-range-function-example
Python range() Function Example
March 17, 2023 - for num in range(5.2, 4.3): print(num) # output # Traceback (most recent call last): # File "main.py", line 1, in <module> # for num in range(5.2, 4.3): # TypeError: 'float' object cannot be interpreted as an integer ยท You can pass either negative or positive integers as start and stop arguments. By default, the increment value is 1 and is not specified. That said, you can change it by passing a step argument to the range() function.
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_range.asp
Python range
The step value means the difference between each number in the sequence. It is optional, and if not provided, it defaults to 1. range(3, 10, 2) returns a sequence of each number from 3 to 9, with a step of 2:
๐ŸŒ
DataCamp
datacamp.com โ€บ tutorial โ€บ python-range-function
Python Range() Function Tutorial | DataCamp
September 16, 2024 - range(start_value, stop_value, step_size): It generates the sequence by incrementing the start value using the step size until it reaches the stop value. Python range() function.
๐ŸŒ
Python.org
discuss.python.org โ€บ ideas
Allow `range(start, None, step)` for an endless range - Ideas - Discussions on Python.org
January 15, 2021 - Currently, to iterate over finite arithmetic sequences of integers, range is used, as in: for i in range(10): print(i) For an infinite arithmetic sequence, there are a few approaches. One can replace the โ€˜10โ€™ with a long sequence of nines, write a generator function or just switch to a while loop, but the current โ€˜bestโ€™ way is using itertools: import itertools for i in itertools.count(): print(i) There are a few downsides to this.
๐ŸŒ
Enki
enki.com โ€บ post โ€บ how-to-use-python-range-function
Enki | Blog - How to use Python Range Function
With two numbers, range() starts from the first number and stops before the second. This specifies a start and stop, creating a list with numbers 2 through 4. The third number defines the step between each number.
๐ŸŒ
PYnative
pynative.com โ€บ home โ€บ python โ€บ python range() explained with examples
Python range() Function Explained with Examples
March 17, 2022 - The value of i is determined by the formula i = i + step. So it means range() produces numbers one by one as the loop moves to the next iteration. It saves lots of memory, which makes range() faster and more efficient.
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ python โ€บ python_range_function.htm
Python range() Function
Following is the syntax of the ... stop โˆ’ This parameter represents the stop position. step โˆ’ It specifies the required number of increment between sequence....
๐ŸŒ
Server Academy
serveracademy.com โ€บ blog โ€บ python-range-tutorial-for-beginners
Python Range() Tutorial for Beginners - Server Academy
November 11, 2024 - The range() function generates a sequence of numbers, which is commonly used in for loops to specify the number of iterations. ... Here, range(5) generates numbers from 0 up to but not including 5. Define a custom starting point by providing ...
๐ŸŒ
InterServer
interserver.net โ€บ home โ€บ python โ€บ how to use the range() function in python loops with examples
How to Use the range() Function in Python Loops With Examples - Interserver Tips
August 4, 2025 - Even if you donโ€™t use i, the loop still counts the steps. You can also set where the counting should start and stop. ... This loop starts at 2 and stops before 7. The start value changes where the loop begins. The step value tells Python how much to increase the number each time.