ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
print(all([]), any([]), all([0, 1]), any([0.0, '']), all(x > 0 for x in [1, -1]))
  1. A. True True False False False
  2. B. True False False False False
  3. C. False False False False False
  4. D. True False True False False

Correct answer: B. True False False False False

all over an empty iterable is True, and any over an empty iterable is False. any tests truthiness, and 0.0 and '' are both falsy.

More Python Programming questions

Exams that ask this topic