From the documentation:

range([start], stop[, step])

The start defaults to 0, the step can be whatever you want, except 0 and stop is your upper bound, it is not the number of iterations. So declare n to be whatever your upper bound is correctly and you will not have to add 1 to it.

e.g.

>>> for i in range(1, 7, 1): print(i)
... 
1
2
3
4
5
6
>>> for i in range(1, 7, 2): print(i)
... 
1
3
5

A nice feature, is that it works in reverse as well.

>>> for i in range(7, 0, -1): print(i)
... 
7
6
5
4
3
2
1

If you aren't using it as an index but for something that can have positive or negative values, it still comes in handy:

>>> for i in range(2, -3, -1): print(i)
... 
2
1
0
-1
-2
>>> for i in range(-2, 3, 1): print(i)
... 
-2
-1
0
1
2
Answer from Rolf of Saxony on Stack Overflow
๐ŸŒ
Real Python
realpython.com โ€บ python-range
Python range(): Represent Numerical Ranges โ€“ Real Python
November 24, 2024 - It can be called with one, two, or three integer arguments to specify the start, stop, and step of the sequence. By default, it starts at 0 and increments by 1 until it reaches the stop value.
Discussions

How do you start a for loop at 1 instead of 0?
Hi! I'm working on a bot to reply with suggestions for common python problems. This might not be very helpful to fix your underlying issue, but here's what I noticed about your submission: You are looping over an object using something like for x in range(len(items)): foo(item[x]) This is simpler and less error prone written as for item in items: foo(item) If you DO need the indexes of the items, use the enumerate function like for idx, item in enumerate(items): foo(idx, item) More on reddit.com
๐ŸŒ r/learnpython
16
6
November 13, 2015
python - Why does range(start, end) not include end? - Stack Overflow
>>> range(1,11) gives you [1,2,3,4,5,6,7,8,9,10] Why not 1-11? Did they just decide to do it like that at random or does it have some value I am not seeing? More on stackoverflow.com
๐ŸŒ stackoverflow.com
Allow `range(start, None, step)` for an endless range - Ideas - Discussions on Python.org
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 ... More on discuss.python.org
๐ŸŒ discuss.python.org
0
January 15, 2021
Loops - for i and for j in range(n) explained
It may seem special, but its just a normal for loop. You can call the range() function separately from these loops to generate a range object. These are iterables, and can be converted into lists, tuples, etc. Try doing something like print(list(range(5))), and it will show [0, 1, 2, 3, 4]. You can think of it just being a normal list, like this: for i in range(5): print(i) for i in [0, 1, 2, 3, 4]: print(i) So to answer your other question about for j in range(i), think about it this way. for i in range(3): for j in range(i): print(j) The first time this runs, i will be 0 and it will increase by 1 every time it the loop runs, so it will be running for i in range(0) the first time, for i in range(1) the second time, and so on. range() accepts 3 arguments, start, stop, and step. Lets do some examples list(range(10)) # stop at 10 # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] list(range(5, 10)) # start at 5, end at 10 # [5, 6, 7, 8, 9] list(range(0, 10, 2)) # start at 0, end at 10, increment by 2 each time # [0, 2, 4, 6, 8] Hopefully this explains it a bit more! More on reddit.com
๐ŸŒ r/learnpython
6
8
July 3, 2021
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ how-to-start-a-for-loop-at-1-python
How to start a for loop at 1 - Python - GeeksforGeeks
July 23, 2025 - In scenarios where a loop inherently starts at 0 we can initialize a counter variable at 1 and increment it manually. ... # Initialize counter start = 1 for _ in range(5): # Loop 5 times print("Current number:", start) start += 1
๐ŸŒ
AskPython
askpython.com โ€บ home โ€บ pythonic way to iterate through a range starting at 1
Pythonic Way to Iterate Through a Range Starting at 1 - AskPython
June 30, 2023 - The range function allows you to create a sequence of numbers with a particular step size. The step size is set to 1 by default. The starting value is set to 0 by default, and we just need to pass the ending value.
๐ŸŒ
Spark By {Examples}
sparkbyexamples.com โ€บ home โ€บ python โ€บ how to start python for loop at 1
How to Start Python For Loop at 1 - Spark By {Examples}
May 31, 2024 - To start a Python for loop at 1 instead of 0, you can use the range function and specify a starting value of 1. For example, range(1,6) generates a sequence of numbers starting from 1 and going up to, but not including, 6.
๐ŸŒ
Snakify
snakify.org โ€บ for loop with range
For loop with range - Learn Python 3 - Snakify
Pay attention that maximum value in range() is n + 1 to make i equal to n on the last step. To iterate over a decreasing sequence, we can use an extended form of range() with three arguments - range(start_value, end_value, step). When omitted, the step is implicitly equal to 1. However, can be any non-zero value. The loop always includes start_value and excludes end_value during iteration:
Find elsewhere
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ gloss_python_for_range.asp
Python Looping Through a Range
Python Examples Python Compiler ... Certificate Python Training ... The range() function returns a sequence of numbers, starting from 0 by default, and increments by 1 (by default), and ends at a specified numbe...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-range-function
Python range() function - GeeksforGeeks
It is most commonly used in loops to control how many times a block of code runs. Note: range() returns a lazy iterable, not a full list. It generates numbers dynamically instead of storing them all in memory.. To access elements like a list, convert it using list(range(...)). Example: This example shows the use of range() to generate numbers starting from 0 up to (but not including) a given value. Python ยท for i in range(5): print(i, end=" ") Output ยท 0 1 2 3 4 ยท
Published ย  1 month ago
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ ref_func_range.asp
Python range() Function
Python Examples Python Compiler ... Certificate Python Training ... The range() function returns a sequence of numbers, starting from 0 by default, and increments by 1 (by default), and stops before a specified ...
๐ŸŒ
PYnative
pynative.com โ€บ home โ€บ python โ€บ python range() explained with examples
Python range() Function Explained with Examples
March 17, 2022 - Python range() function generates the immutable sequence of numbers starting from the given start integer to the stop integer. The range() is a built-in function that returns a range object that consists series of integer numbers, which we can ...
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ python-for-loop-for-i-in-range-example
Python For Loop - For i in Range Example
March 30, 2021 - The range() function provides a sequence of integers based upon the function's arguments. Additional information can be found in Python's documentation for the range() function. ... The start argument is the first value in the range.
๐ŸŒ
Mimo
mimo.org โ€บ glossary โ€บ python โ€บ range-function
Python range() Function [Python Tutorial]
The Python range() function generates a sequence of numbers in a range. By default, range() starts at 0, increments by 1, and stops before a specified number. The range() function generates a sequence of numbers, which is most commonly used to control for loops.
Top answer
1 of 11
331

Because it's more common to call range(0, 10) which returns [0,1,2,3,4,5,6,7,8,9] which contains 10 elements which equals len(range(0, 10)). There's a tendency in programming to use 0-based indexing.

Also, consider the following common code snippet:

for i in range(len(li)):
    pass

Could you see that if range() went up to exactly len(li) that this would be problematic? The programmer would need to explicitly subtract 1. This also follows the common trend of programmers preferring for(int i = 0; i < 10; i++) over for(int i = 0; i <= 9; i++).

If you are calling range with a start of 1 frequently, you might want to define your own function:

>>> def range1(start, end):
...     return range(start, end+1)
...
>>> range1(1, 10)
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
2 of 11
100

Although there are some useful algorithmic explanations here, I think it may help to add some simple 'real life' reasoning as to why it works this way, which I have found useful when introducing the subject to young newcomers:

With something like 'range(1,10)' confusion can arise from thinking that pair of parameters represents the "start and end".

It is actually start and "stop".

Now, if it were the "end" value then, yes, you might expect that number would be included as the final entry in the sequence. But it is not the "end".

Others mistakenly call that parameter "count" because if you only ever use 'range(n)' then it does, of course, iterate 'n' times. This logic breaks down when you add the start parameter.

So the key point is to remember its name: "stop". That means it is the point at which, when reached, iteration will stop immediately. Not after that point.

So, while "start" does indeed represent the first value to be included, on reaching the "stop" value it 'breaks' rather than continuing to process 'that one as well' before stopping.

One analogy that I have used in explaining this to kids is that, ironically, it is better behaved than kids! It doesn't stop after it supposed to - it stops immediately without finishing what it was doing. (They get this ;) )

Another analogy - when you drive a car you don't pass a stop/yield/'give way' sign and end up with it sitting somewhere next to, or behind, your car. Technically you still haven't reached it when you do stop. It is not included in the 'things you passed on your journey'.

I hope some of that helps in explaining to Pythonitos/Pythonitas!

๐ŸŒ
Free Outlook
web.nutritionjobs.com โ€บ home โ€บ news โ€บ python `for` loop: start `range()` from 1
Python `for` Loop: Start `range()` From 1
January 6, 2026 - Python for Loop: Start range() from 1 Hey guys! Ever found yourself needing a Python for loop to start counting from 1 instead of the usual 0? Itโ€™s a...
๐ŸŒ
Python Tutorial
pythontutorial.net โ€บ home โ€บ python basics โ€บ python for loop with range
A Basic Guide to Python for Loop with the range() Function
March 26, 2025 - In this syntax, the range() function increases the start value by one until it reaches the stop value. The following example uses a for loop to show five numbers, from 1 to 5 to the screen: for index in range(1, 6): print(index)Code language: ...
๐ŸŒ
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 - 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. ... Here, range(0, 10, 2) skips every second number. You can even count backward using a negative step. ... This is useful when you want to reverse a loop or create a countdown. While the range() function is mostly used with for loops, you can get the same result with a while loop by using a counter.
๐ŸŒ
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.