ProgrammingHardTCS NQT · Wipro pattern

What is printed?

What is printed?
print('a' < 'B', 'a'.upper() < 'B')
  1. A. True True
  2. B. False False
  3. C. False True
  4. D. True False

Correct answer: C. False True

Comparison uses code points, so 'a' (97) is greater than 'B' (66). Uppercasing a gives 'A' (65), which is less than 'B'.

More Python Programming questions

Exams that ask this topic