ProgrammingHardTCS NQT · Infosys
What is printed?
What is printed?
s = 'Straße' print(s.upper(), s.lower(), s.casefold() == 'strasse', len(s.upper()))
- A. STRASSE straße False 6
- B. STRASSE strasse True 7
- C. STRASSE straße True 6
- 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
- What is printed? python print(0.1 0.1 == 0.01, 0.1 0.1, round(0.1 0.1, 2) == 0.01)
- What is printed? python print(int(3.99999999999999999), int(-3.7), 3.99999999999999999 == 4.0, 3)
- What is printed? python s = 'x' 3 print(s -1 == '', s.replace('x', 'xy', 2), s.count('xx'), s.index('x', 1))
- What is printed? python print(' '.join(str(i) for i in range(3)), ','.join(f'{i:02d}' for i in (1, 10)), '|'.join(['x']), ''.join([''…
- What is printed? python print(max(3, 3.0), max(3.0, 3), min(-0.0, 0), min(0, -0.0))
- What is printed? python print('abc'[1:][::-1], 'abc'[::-1][1:], 'abcdef'[::-2][:2])