@@ -62,7 +62,7 @@ And as an unordered data type, they can't be indexed.
62
62
# TypeError: 'set' object does not support indexing
63
63
```
64
64
65
- ## set add() and update()
65
+ ## set add and update
66
66
67
67
Using the ` add() ` method we can add a single element to the set.
68
68
@@ -82,7 +82,7 @@ And with `update()`, multiple ones:
82
82
# {1, 2, 3, 4, 5, 6}
83
83
```
84
84
85
- ## set remove() and discard()
85
+ ## set remove and discard
86
86
87
87
Both methods will remove an element from the set, but ` remove() ` will raise a ` key error ` if the value doesn't exist.
88
88
@@ -108,7 +108,7 @@ Both methods will remove an element from the set, but `remove()` will raise a `k
108
108
>> > s.discard(3 )
109
109
```
110
110
111
- ## set union()
111
+ ## set union
112
112
113
113
` union() ` or ` | ` will create a new set with all the elements from the sets provided.
114
114
@@ -119,7 +119,7 @@ Both methods will remove an element from the set, but `remove()` will raise a `k
119
119
# {1, 2, 3, 4, 5}
120
120
```
121
121
122
- ## set intersection()
122
+ ## set intersection
123
123
124
124
` intersection() ` or ` & ` will return a set with only the elements that are common to all of them.
125
125
@@ -131,7 +131,7 @@ Both methods will remove an element from the set, but `remove()` will raise a `k
131
131
# {3}
132
132
```
133
133
134
- ## set difference()
134
+ ## set difference
135
135
136
136
` difference() ` or ` - ` will return only the elements that are unique to the first set (invoked set).
137
137
@@ -146,7 +146,7 @@ Both methods will remove an element from the set, but `remove()` will raise a `k
146
146
# {4}
147
147
```
148
148
149
- ## set symmetric_difference()
149
+ ## set symmetric_difference
150
150
151
151
` symmetric_difference() ` or ` ^ ` will return all the elements that are not common between them.
152
152
0 commit comments