summaryrefslogtreecommitdiff
path: root/tests/basics/dict_popitem.py
blob: 0e3384253f8066aff6731c7d5d6bb5a8af5202a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
els = []
d = {1:2,3:4}
a = d.popitem()
print(len(d))
els.append(a)
a = d.popitem()
print(len(d))
els.append(a)
try:
    print(d.popitem(), "!!!",)
except KeyError:
    print("Raised KeyError")
else:
    print("Did not raise KeyError")
print(sorted(els))