Browse Source

List and set

pull/28/head
Jure Šorn 6 years ago
parent
commit
356dc8136c
1 changed files with 9 additions and 13 deletions
  1. 22
      README.md

22
README.md

@ -21,10 +21,8 @@ List
``` ```
```python ```python
<list>.append(<el>)
<list>.extend(<collection>)
<list> += [<el>]
<list> += <collection>
<list>.append(<el>) # Or: <list> += [<el>]
<list>.extend(<collection>) # Or: <list> += <collection>
``` ```
```python ```python
@ -45,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.
``` ```
@ -98,10 +96,8 @@ Set
``` ```
```python ```python
<set>.add(<el>)
<set>.update(<collection>)
<set> |= {<el>}
<set> |= <set>
<set>.add(<el>) # Or: <set> |= {<el>}
<set>.update(<collection>) # Or: <set> |= <set>
``` ```
```python ```python

Loading…
Cancel
Save