#python #sicp
Ranges commonly appear as the expression in a for header to specify the
number of times that the suite should be executed: A common convention is to
use a single underscore character for the name in the for header if the
name is unused in the suite:
If you want to change selection, open document below and click on "Move attachment"
2.3 Sequencesat 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))
[0, 1, 2, 3]
<span>Ranges commonly appear as the expression in a for header to specify the
number of times that the suite should be executed: A common convention is to
use a single underscore character for the name in the for header if the
name is unused in the suite:
>>> for _ in range(3):
print('Go Bears!')
Go Bears!
Go Bears!
Go Bears!
This underscore is just another name in the environment as far as the
interpreter is conce Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details