What is printed?
d = {}
d[1] = 'int'
d[1.0] = 'float'
d[True] = 'bool'
print(len(d), d[1])
- 1 bool
- 3 int
- 2 float
- 1 int
1, 1.0 and True hash equal, so each write replaces the same single entry.
Play Problem Solving ▸
d = {}
d[1] = 'int'
d[1.0] = 'float'
d[True] = 'bool'
print(len(d), d[1])