$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · medium · #111

What is printed?

d = {'a': 1}
print(d.get('b'), d.get('b', 0))
  1. None 0
  2. 0 0
  3. KeyError
  4. None None
get returns None for a missing key unless a default is given.
Play Problem Solving ▸