Skip to content

Commit 356dc81

Browse files
committed
List and set
1 parent 245724f commit 356dc81

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

README.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ List
2121
```
2222

2323
```python
24-
<list>.append(<el>)
25-
<list>.extend(<collection>)
26-
<list> += [<el>]
27-
<list> += <collection>
24+
<list>.append(<el>) # Or: <list> += [<el>]
25+
<list>.extend(<collection>) # Or: <list> += <collection>
2826
```
2927

3028
```python
@@ -45,11 +43,11 @@ list_of_chars = list(<str>)
4543
```
4644

4745
```python
48-
index = <list>.index(<el>) # Returns first index of item.
49-
<list>.insert(index, <el>) # Inserts item at index and moves the rest to the right.
50-
<el> = <list>.pop([index]) # Removes and returns item at index or from the end.
51-
<list>.remove(<el>) # Removes first occurrence of item or raises ValueError.
52-
<list>.clear() # Removes all items.
46+
index = <list>.index(<el>) # Returns first index of item.
47+
<list>.insert(index, <el>) # Inserts item at index and moves the rest to the right.
48+
<el> = <list>.pop([index]) # Removes and returns item at index or from the end.
49+
<list>.remove(<el>) # Removes first occurrence of item or raises ValueError.
50+
<list>.clear() # Removes all items.
5351
```
5452

5553

@@ -98,10 +96,8 @@ Set
9896
```
9997

10098
```python
101-
<set>.add(<el>)
102-
<set>.update(<collection>)
103-
<set> |= {<el>}
104-
<set> |= <set>
99+
<set>.add(<el>) # Or: <set> |= {<el>}
100+
<set>.update(<collection>) # Or: <set> |= <set>
105101
```
106102

107103
```python

0 commit comments

Comments
 (0)