ProgrammingHardTCS NQT · Infosys
What is printed?
What is printed?
print('straße'.casefold() == 'strasse', 'straße'.lower() == 'strasse', 'Straße'.casefold())- A. False False strasse
- B. True False strasse
- C. True True strasse
- 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
- What is printed? python print('x'.removeprefix('xx'), 'hello'.removesuffix('llo'), 'abc'.removeprefix(''))
- What is printed? python print(str.maketrans('ab', 'xy', 'c'), 'abcabc'.translate(str.maketrans('ab', 'xy', 'c')))
- What is printed? python print(sorted(['10', '9', '100', '2']), sorted(map(int, ['10', '9', '100', '2'])))
- What is printed? python print(-7 // -2, 7 // -2 -2 + 7 % -2)
- What is printed? python print(round(-2.5), round(-3.5), round(7, -1), round(15, -1), round(25, -1))
- What is printed? python print(int('12abc', 36), int('zz', 36), int('-z', 36))