$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · easy · #60

What is printed?

print(sorted("banana"))
  1. ['a', 'a', 'a', 'b', 'n', 'n']
  2. ['a', 'b', 'n']
  3. 'aaabnn'
  4. ['b', 'a', 'n', 'a', 'n', 'a']
sorted() always returns a list of the sorted characters, duplicates included.
Play Problem Solving ▸