ProgrammingVery hardCAT · MBA placement
What is printed?
What is printed?
print(len('\u0301'), len('a\u0301'), 'a\u0301'.upper() == 'A\u0301')- A. 1 1 True
- B. 2 2 True
- C. 1 2 True
- D. 1 2 False
Correct answer: C. 1 2 True
A combining accent is its own code point, so it counts as one character. Attaching it to a is two characters, and upper() keeps the accent unchanged, so the uppercase form still matches.
More Python Programming questions
- What is printed? python words = 'the quick the lazy'.split() counts = {} for w in words: counts[w] = counts.get(w, 0) + 1 print(counts…
- What is printed? python print(sorted(['B', 'a', 'C'], key=str.casefold) == ['a', 'B', 'C'], sorted(['B', 'a', 'C']) == ['B', 'C', 'a']…
- What is printed? python print(int('1000') + int('01'), '1000'.replace('', '') == '1000', float('10.50'), '%.1f' % float('10.50'))
- What is printed? python print(round(-1234.5, -2), round(123456.0, -3), round(0.0, 2), round(1e-7, 7))
- What is printed? python print(str(1.0), str(1), str(1.0e0), str(10.0 0), repr(1e0))
- What is printed? python print(7 & ~1, 7 >> 1 << 1, (7 | 8) & 12, 6 ^ 3 ^ 3)