range¶
Syntax¶
Parameters¶
start- An expression that evaluates to a number. The value is truncated to an integer value.
stop- An expression that evaluates to a number. The value is truncated to an integer value.
step- An expression that evaluates to a number. The value is truncated to an integer value.
Returns¶
A list of integer values.
Description¶
This action returns a list of integers from start and counting by step up to, but not including, stop.
If two arguments are supplied, then step = 1.
If one argument is supplied, then start = 0 and step = 1.
If step = 0, then a run-time error occurs.
If step > 0 and stop <= start, then the resulting list is empty.
If step < 0 and start <= stop, then the resulting list is empty.
Examples¶
Each of the following statements sets my_list to list(0, 1, 2):
The following statement sets my_list to list(1, 0, -1):
This example sets index_list to the index values for x_list. The result is that index_list is set to list(0, 1, 2)