ProgrammingVery hardCAT · MBA placement

What is printed?

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

Correct answer: D. 2 False

The escape \u0301 is a combining acute accent, so 'e' followed by it is two code points. The precomposed 'é' is a single code point, so the strings are different even though they look the same.

More Python Programming questions

Exams that ask this topic