ProgrammingHardTCS NQT · Infosys
What is printed?
What is printed?
print('a1'.isalnum(), '١'.isalnum(), ' '.isspace(), ''.isspace(), '\u00a0'.isspace())- A. True True True False True
- B. True False True False True
- C. True True False False True
- D. True True True True True
Correct answer: A. True True True False True
isalnum is True for letters and decimal digits in any script, and a space is whitespace. The empty string is not whitespace, while the no-break space U+00A0 counts as whitespace.
More Python Programming questions
- 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)
- What is printed? python def f(s): return s[::-1] == s print(f('abba'), f('ab' 2), f(''), f('a'))