#python #sicp
Calling the list constructor on a range evaluates to a list with the same
elements as the range, so that the elements can be easily inspected.
If you want to change selection, open document below and click on "Move attachment"
2.3 Sequences
represents a range of integers. Ranges are created with range , which takes
two integer arguments: the first number and one beyond the last number in the
desired range.
>>> range(1, 10) # Includes 1, but not 10
range(1, 10)
<span>Calling the list constructor on a range evaluates to a list with the same
elements as the range, so that the elements can be easily inspected.
>>> list(range(5, 8))
[5, 6, 7]
If only one argument is given, it is interpreted as one beyond the last value
for a range that starts at 0.
>>> list(range(4))
Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details