ProgrammingModerateTCS NQT · Wipro pattern

What is printed?

What is printed?
print(len(bytes('é', 'utf-8')), len('é'))
  1. A. 2 1
  2. B. 1 1
  3. C. 2 2
  4. D. 3 1

Correct answer: A. 2 1

The letter é takes two bytes in UTF-8, but the string holds it as one character.

More Python Programming questions

Exams that ask this topic