ProgrammingVery hardTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
print(min('10', '9'), min(10, 9), max('10', '9', key=int))
  1. A. 10 9 10
  2. B. 9 9 9
  3. C. 10 9 9
  4. D. 9 9 10

Correct answer: A. 10 9 10

Strings compare character by character, so '10' < '9' and min gives '10'. Numbers compare numerically, so min(10, 9) is 9. With key=int, max compares 10 and 9 as numbers and returns the original string '10'.

More Python Programming questions

Exams that ask this topic