Skip to content

Commit b411f69

Browse files
committed
add pop() method for sets
1 parent ff6bbbb commit b411f69

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Additional links:
5151
4.0
5252
>>> 4 / 2
5353
2.0
54-
>>> 4 // 2 # `//` is the integer division
54+
>>> 5 // 2 # `//` is the integer division
5555
2
5656
>>> 3 % 2
5757
1
@@ -362,7 +362,9 @@ True
362362
>>> s.remove(1)
363363
>>> s
364364
{2, 'a'}
365-
>>> s.remove(1) # KeyError: 1
365+
>>> s.remove(1) # `KeyError: 1`
366+
>>> s.pop() # Remove and return an arbitrary element from the set
367+
2
366368

367369
>>> s0 = {1, 2, 'a'}
368370
>>> s0
@@ -423,7 +425,7 @@ False
423425
>>> d
424426
{'a': 'hello, world!', 'b': 11, 1: 'a new element'}
425427

426-
>>> d[0] += 10 # KeyError: 0
428+
>>> d[0] += 10 # `KeyError: 0`
427429
>>> d.get(0, 1) # Return `1` as default value since key `0` does not exist
428430
1
429431
>>> d.get(1, '?') # Key `1` exists, so the actual value will be returned

0 commit comments

Comments
 (0)