ProgrammingVery hardCAT · MBA placement
What is printed?
What is printed?
print(len('e\u0301'), 'é' == 'e\u0301')- A. 1 True
- B. 1 False
- C. 2 True
- D. 2 False
Correct answer: D. 2 False
The escape \u0301 is a combining acute accent, so 'e' followed by it is two code points. The precomposed 'é' is a single code point, so the strings are different even though they look the same.
More Python Programming questions
- What is printed? python print(0b1010 & ~0b10, 0b1010 ^ 0b1111, 1 << 3 | 1, 6 & 3 == 2)
- What is printed? python print(1 << 100 >> 99) try: print(1 >> -1) except ValueError as e: print(e)
- What is printed? python print(len(str(21000)), sum(map(int, str(21000))))
- What is printed? python print(1018 10 // 1018 == 10, type(1018 / 1018))
- What is printed? python print(round(1.005, 2), round(0.285, 2), round(1.45, 1))
- What is printed? python print('abcdef'[4:1:-2], 'abc'[::-2], 'abc'[-5:], 'abc'[5:] == '')