ProgrammingVery hardCAT · MBA placement
What is printed?
What is printed?
import unicodedata
print(unicodedata.normalize('NFC', 'e\u0301') == 'é', len(unicodedata.normalize('NFD', 'é')), 'é'.isidentifier(), 'Dž'.isidentifier())- A. True 1 True False
- B. False 2 True True
- C. True 2 False True
- D. True 2 True True
Correct answer: D. True 2 True True
NFC composes e followed by a combining accent into the single code point é, and NFD splits it back into two. Both letters are valid identifier characters, and the title-case digraph Dž is a letter.
More Python Programming questions
- What is printed? python print('a1'.isalnum(), '١'.isalnum(), ' '.isspace(), ''.isspace(), 'u00a0'.isspace())
- What is printed? python def fermatinverse(a, p): return pow(a, p - 2, p) print(fermatinverse(3, 7) == pow(3, -1, 7), 3 fermatinverse(3, 7)…
- What is printed? python print(sorted(['beta', 'Alpha', 'alpha', 'Beta'], key=str.lower))
- What is printed? python x = 0.1 + 0.7 print(x, x 10, int(x 10), round(x 10))
- What is printed? python print(int('3' 3) + int('4' 2) 2, '3' 3 + '4' 2 2)
- What is printed? python print(len('%s' % 1.0), len('%g' % 1.0), len(repr(1.0)), str(1e5), '%g' % 1e5, '%g' % 1e6)