Skip to content

Commit 92a8a73

Browse files
committed
Added example
1 parent eca8be3 commit 92a8a73

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Notes/02_Working_with_data/02_Containers.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,14 @@ unique = set(names)
195195
Additional set operations:
196196

197197
```python
198-
names.add('CAT') # Add an item
199-
names.remove('YHOO') # Remove an item
200-
201-
s1 | s2 # Set union
202-
s1 & s2 # Set intersection
203-
s1 - s2 # Set difference
198+
unique.add('CAT') # Add an item
199+
unique.remove('YHOO') # Remove an item
200+
201+
s1 = { 'a', 'b', 'c'}
202+
s2 = { 'c', 'd' }
203+
s1 | s2 # Set union { 'a', 'b', 'c', 'd' }
204+
s1 & s2 # Set intersection { 'c' }
205+
s1 - s2 # Set difference { 'a', 'b' }
204206
```
205207

206208
## Exercises

0 commit comments

Comments
 (0)