ProgrammingHardTCS NQT · Infosys

What is printed?

What is printed?
s = 'Straße'
print(s.upper(), s.lower(), s.casefold() == 'strasse', len(s.upper()))
  1. A. STRASSE straße False 6
  2. B. STRASSE strasse True 7
  3. C. STRASSE straße True 6
  4. D. STRASSE straße True 7

Correct answer: D. STRASSE straße True 7

upper() maps ß to SS, which makes the upper form seven characters long, and lower() keeps ß. casefold() gives strasse, so that comparison is True.

More Python Programming questions

Exams that ask this topic