Slide 44
Slide 44 text
Sets and Dicts
Yet, sets and dicts don't play together
a = {
'Guido': 1,
'Barry': 2,
'Tim': 3,
'Paula': 4
}
b = {
'Dave': 5,
'Paula': 6,
'Thomas': 7,
'Lewis': 8
}
Find keys in common
>>> a.keys() & b.keys()
Traceback (most recent call last):
File "", line 1, in
TypeError: unsupported operand type(s) for &: 'list'
and 'list'
>>>