ProgrammingHardTCS NQT · Infosys

What is printed?

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

Correct answer: B. True False strasse

casefold() maps ß to ss, so the first comparison is True. lower() keeps ß, so the second is False, and casefold() of 'Straße' gives strasse.

More Python Programming questions

Exams that ask this topic