Skip to content

Commit 1f710d5

Browse files
authored
Merge pull request #1 from dabeaz-course/master
updating from master fork
2 parents 708a0a7 + 92a8a73 commit 1f710d5

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

Notes/02_Working_with_data/02_Containers.md

Lines changed: 8 additions & 6 deletions
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

Notes/02_Working_with_data/03_Formatting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ modeled after the C `printf()` as well.
115115
*Note: This is the only formatting available on byte strings.*
116116

117117
```python
118-
>>> b'%s has %n messages' % (b'Dave', 37)
118+
>>> b'%s has %d messages' % (b'Dave', 37)
119119
b'Dave has 37 messages'
120120
>>>
121121
```

Notes/02_Working_with_data/06_List_comprehension.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ For example, this determines the set of unique stock names that appear in `portf
215215
```python
216216
>>> names = { s['name'] for s in portfolio }
217217
>>> names
218-
{ 'AA', 'GE', 'IBM', 'MSFT', 'CAT'] }
218+
{ 'AA', 'GE', 'IBM', 'MSFT', 'CAT' }
219219
>>>
220220
```
221221

0 commit comments

Comments
 (0)