ProgrammingModerateTCS NQT · Wipro pattern

What is printed?

What is printed?
print(len(''), len(' '), len('\t'), ''.isspace())
  1. A. 0 0 1 False
  2. B. 0 1 1 False
  3. C. 0 1 1 True
  4. D. 1 1 1 False

Correct answer: B. 0 1 1 False

The empty string has length 0, while a space and a tab are one character each. isspace on the empty string is False, since it needs at least one whitespace character.

More Python Programming questions

Exams that ask this topic