Skip to content

Commit f234dae

Browse files
Update errata.md
1 parent ac7828f commit f234dae

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

errata.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,20 @@ mid = start + (end - start)//2
3333
if arr[mid] == key:
3434
return mid
3535
```
36+
37+
38+
## Chapter 1, Page 23 - Fixed the missing outputs
39+
40+
This is the actual dictionary
41+
`mydict = {'a': 1, 'b': 2, 'c': 3}`
42+
43+
|Function |Description |Example|
44+
| :-------:| :-------: | :-------: |
45+
| `mydict.pop()`| If a given key is present in the dictionary, then this function will remove the key and return the associated value. | `print(mydict.pop('b'))` should give you output `2` |
46+
| `| | `print(mydict)` should give you output `{'a': 1, 'c': 3}` |
47+
| `mydict.popitem()`| This method removes the last key-value pair added in the dictionary and returns it as a tuple. | `print(mydict.popitem())` should give you output `('c', 3)` |
48+
| `| | `print(mydict)` should give you output `{'a': 1, 'b': 2}` |
49+
| `mydict.update(<obj>)`| Merges one dictionary with another. Firstly, it checks whether a key of the second dictionary is present in the fi rst dictionary; the corresponding value is then updated. If the key is not present in the fi rst dictionary, then the key-value pair is added. | It has two dictionaries as `d1 = {'a': 10, 'b': 20, 'c': 30}` and `d2 = {'b': 200, 'd': 400}`|
50+
| | | `d1.update(d2)` should update values of `d2` on `d1` |
51+
| | | `print(d1)` should give you `{'a': 10, 'b': 200, 'c': 30, 'd': 400}` |
52+

0 commit comments

Comments
 (0)