ProgrammingVery hardCAT · MBA placement

What is printed?

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

Correct answer: C. 1 2 True

A combining accent is its own code point, so it counts as one character. Attaching it to a is two characters, and upper() keeps the accent unchanged, so the uppercase form still matches.

More Python Programming questions

Exams that ask this topic