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

What is printed?

print(sorted({'b': 1, 'a': 2}))
  1. ['a', 'b']
  2. ['b', 'a']
  3. [1, 2]
  4. [2, 1]
Iterating a dict yields its keys, so sorted() returns the sorted keys.
Play Problem Solving ▸