ProgrammingVery hardCAT · MBA placement
What is printed?
What is printed?
print('²'.isdigit(), '²'.isdecimal(), '²'.isnumeric(), '٥'.isdecimal())- A. True False True True
- B. True True True True
- C. False False True True
- D. True False False True
Correct answer: A. True False True True
The superscript two is a digit but not a decimal character, so isdigit() is True and isdecimal() is False. isnumeric() is True for it, and the Arabic-Indic five is a decimal character.
More Python Programming questions
- What is printed? python print(len('é'.encode('utf-8')), len('é'.encode('utf-16-le')), len('a€'.encode()), b'xc3xa9'.decode())
- What is printed? python print(f"{12:>{5}}|{3.14159:.{2}f}|{'ab':^6}")
- What is printed? python x = 12 print(x & -x, x ^ (x - 1), (x & (x - 1)) == 0, -x & x == x & -x)
- What is printed? python print((-5).tobytes(2, 'big', signed=True).hex(), int.frombytes(b'xffxfb', 'big', signed=True)…
- What is printed? python import math print(math.fsum([0.1] 10) == 1.0, sum([0.1] 10) == 1.0, math.isqrt(10 30 - 1))
- What is printed? python print(sorted(['pear', 'Fig', 'apple', 'banana', 'kiwi'], key=lambda s: (len(s), s.lower())))