ProgrammingVery hardCAT · MBA placement
What is printed?
What is printed?
print('ß'.upper(), 'Dž'.lower(), len('ß'.upper()), 'İ'.lower() == 'i')- A. SS dž 1 True
- B. ß dž 1 False
- C. SS dž 2 False
- D. SS dž 2 True
Correct answer: C. SS dž 2 False
Full Unicode case mapping turns German sharp s into the two letters SS, so its upper form has length 2. The Latin letter dz with caron lowercases to dž, and the dotted capital I lowercases to i followed by a combining dot, so it is not equal to plain 'i'.
More Python Programming questions
- What is printed? python import math print(f'{-0.0}', -0.0 == 0.0, math.copysign(1, -0.0))
- What is printed? python print(1 == 1.0, hash(1) == hash(1.0), {1: 'a'}[1.0], True + 1.0)
- What is printed? python print(sorted([3, -3, 2, -2, 1], key=abs))
- What is printed? python print(f'{-1.5:+.1f}', f'{0.5:.0f}', f'{1.5:.0f}', f'{-0.04:.1f}')
- What is printed? python print(format('x', '>4') + '|' + format(3.14159, '^9.2f') + '|' + format(42, '+') + '|' + format(1234567, ','))
- What is printed? python print('%d%%' % 50, '%x' % 255, '%o' % 8, '%e' % 12345.678)