|
@ -21,8 +21,8 @@ List |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
```python |
|
|
```python |
|
|
<list>.append(<el>) # Or: <list> += [<el>] |
|
|
|
|
|
<list>.extend(<collection>) # Or: <list> += <collection> |
|
|
|
|
|
|
|
|
<list>.append(<el>) # Or: <list> += [<el>] |
|
|
|
|
|
<list>.extend(<collection>) # Or: <list> += <collection> |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
```python |
|
|
```python |
|
@ -43,11 +43,11 @@ list_of_chars = list(<str>) |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
```python |
|
|
```python |
|
|
index = <list>.index(<el>) # Returns first index of item. |
|
|
|
|
|
<list>.insert(index, <el>) # Inserts item at index and moves the rest to the right. |
|
|
|
|
|
<el> = <list>.pop([index]) # Removes and returns item at index or from the end. |
|
|
|
|
|
<list>.remove(<el>) # Removes first occurrence of item or raises ValueError. |
|
|
|
|
|
<list>.clear() # Removes all items. |
|
|
|
|
|
|
|
|
index = <list>.index(<el>) # Returns first index of item. |
|
|
|
|
|
<list>.insert(index, <el>) # Inserts item at index and moves the rest to the right. |
|
|
|
|
|
<el> = <list>.pop([index]) # Removes and returns item at index or from the end. |
|
|
|
|
|
<list>.remove(<el>) # Removes first occurrence of item or raises ValueError. |
|
|
|
|
|
<list>.clear() # Removes all items. |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|