#python #sicp
This pattern of binding multiple names to multiple values in a fixed-length
sequence is called sequence unpacking; it is the same pattern that we see in
assignment statements that bind multiple names to multiple values.
If you want to change selection, open document below and click on "Move attachment"
2.3 Sequenceswo names in its header will bind each name
x and y to the first and second elements in each pair, respectively.
>>> for x, y in pairs:
if x == y:
same_count = same_count + 1
>>> same_count
2
<span>This pattern of binding multiple names to multiple values in a fixed-length
sequence is called sequence unpacking; it is the same pattern that we see in
assignment statements that bind multiple names to multiple values.
Ranges. A range is another built-in type of sequence in Python, which
represents a range of integers. Ranges are created with range , which takes
two integer arguments: the first Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details