$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · hard · #80

What is printed?

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