ProgrammingVery hardTCS NQT · Accenture

What is printed?

What is printed?
print(sorted(['B', 'a', 'C'], key=str.casefold) == ['a', 'B', 'C'], sorted(['B', 'a', 'C']) == ['B', 'C', 'a'], min('Bb'), max('aB'))
  1. A. True False B B
  2. B. True True B B
  3. C. False True a a
  4. D. True True B a

Correct answer: D. True True B a

casefold sorts a, B, C as letters, and default sorting puts uppercase letters before lowercase ones, so B and C come before a. min('Bb') compares B with b, which is B, and max('aB') is a.

More Python Programming questions

Exams that ask this topic