Name
range
Synopsis
range([start,]stop[,step=1])
Returns a list of integers in arithmetic progression:
[start,start+step,start+2*step, ...]
When start is missing, it defaults to
0. When step is
missing, it defaults to 1. When
step is 0,
range raises ValueError. When
step is greater than 0,
the last item is the largest
start
+
i
*
step
strictly less than stop. When
step is less than 0,
the last item is the smallest
start
+
i
*
step
strictly greater than stop. The result is
an empty list when start is greater than
or equal to stop and
step is greater than 0,
or when start is less than or equal to
stop and step
is less than 0. Otherwise, the first item of the
result list is always start.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access