The elements of a list can be accessed in two ways. The first way is via our
familiar method of multiple assignment, which unpacks a list into its elements
and binds each element to a different name.
If you want to change selection, open document below and click on "Move attachment"
2.2 Data Abstractiona abstraction, Python
provides a compound structure called a list , which can be constructed by
placing expressions within square brackets separated by commas. Such an
expression is called a list literal.
>>> [10, 20]
[10, 20]
<span>The elements of a list can be accessed in two ways. The first way is via our
familiar method of multiple assignment, which unpacks a list into its elements
and binds each element to a different name.
>>> pair = [10, 20]
>>> pair
[10, 20]
>>> x, y = pair
>>> x
10
>>> y
20
A second method for accessing the elements in a list is by the Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details