Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.

#python #sicp

lists can be added together and multiplied by integers. For
sequences, addition and multiplication do not add or multiply elements, but
instead combine and replicate the sequences themselves. That is, the add function in the operator module (and the + operator) yields a list that
is the concatenation of the added arguments. The mul function in operator (and the * operator) can take a list and an integer k to
return the list that consists of k repetitions of the original list.

If you want to change selection, open document below and click on "Move attachment"

**2.3 Sequences**

he built-in len function returns the length of a sequence. Below, digits is a list with four elements. The element at index 3 is 8. >>> digits = [1, 8, 2, 8] >>> len(digits) 4 >>> digits[3] 8 Additionally, <span>lists can be added together and multiplied by integers. For sequences, addition and multiplication do not add or multiply elements, but instead combine and replicate the sequences themselves. That is, the add function in the operator module (and the + operator) yields a list that is the concatenation of the added arguments. The mul function in operator (and the * operator) can take a list and an integer k to return the list that consists of k repetitions of the original list. >>> [2, 7] + digits * 2 [2, 7, 1, 8, 2, 8, 1, 8, 2, 8] Any values can be included in a list, including another list. Element selection can be applied multiple times in or

he built-in len function returns the length of a sequence. Below, digits is a list with four elements. The element at index 3 is 8. >>> digits = [1, 8, 2, 8] >>> len(digits) 4 >>> digits[3] 8 Additionally, <span>lists can be added together and multiplied by integers. For sequences, addition and multiplication do not add or multiply elements, but instead combine and replicate the sequences themselves. That is, the add function in the operator module (and the + operator) yields a list that is the concatenation of the added arguments. The mul function in operator (and the * operator) can take a list and an integer k to return the list that consists of k repetitions of the original list. >>> [2, 7] + digits * 2 [2, 7, 1, 8, 2, 8, 1, 8, 2, 8] Any values can be included in a list, including another list. Element selection can be applied multiple times in or

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

Do you want to join discussion? Click here to log in or create user.