ProgrammingHardTCS NQT · Infosys

What is printed?

What is printed?
print('a1'.isalnum(), '١'.isalnum(), ' '.isspace(), ''.isspace(), '\u00a0'.isspace())
  1. A. True True True False True
  2. B. True False True False True
  3. C. True True False False True
  4. 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

Exams that ask this topic