Skip to content

Commit 03ecc19

Browse files
committed
Refactor set method names in sets.md
1 parent f64b3fb commit 03ecc19

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/cheatsheet/sets.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ And as an unordered data type, they can't be indexed.
6262
# TypeError: 'set' object does not support indexing
6363
```
6464

65-
## set add() and update()
65+
## set add and update
6666

6767
Using the `add()` method we can add a single element to the set.
6868

@@ -82,7 +82,7 @@ And with `update()`, multiple ones:
8282
# {1, 2, 3, 4, 5, 6}
8383
```
8484

85-
## set remove() and discard()
85+
## set remove and discard
8686

8787
Both methods will remove an element from the set, but `remove()` will raise a `key error` if the value doesn't exist.
8888

@@ -108,7 +108,7 @@ Both methods will remove an element from the set, but `remove()` will raise a `k
108108
>>> s.discard(3)
109109
```
110110

111-
## set union()
111+
## set union
112112

113113
`union()` or `|` will create a new set with all the elements from the sets provided.
114114

@@ -119,7 +119,7 @@ Both methods will remove an element from the set, but `remove()` will raise a `k
119119
# {1, 2, 3, 4, 5}
120120
```
121121

122-
## set intersection()
122+
## set intersection
123123

124124
`intersection()` or `&` will return a set with only the elements that are common to all of them.
125125

@@ -131,7 +131,7 @@ Both methods will remove an element from the set, but `remove()` will raise a `k
131131
# {3}
132132
```
133133

134-
## set difference()
134+
## set difference
135135

136136
`difference()` or `-` will return only the elements that are unique to the first set (invoked set).
137137

@@ -146,7 +146,7 @@ Both methods will remove an element from the set, but `remove()` will raise a `k
146146
# {4}
147147
```
148148

149-
## set symmetric_difference()
149+
## set symmetric_difference
150150

151151
`symmetric_difference()` or `^` will return all the elements that are not common between them.
152152

0 commit comments

Comments
 (0)