ProgrammingModerateCapgemini · Python

What is printed?

What is printed?
print(all([]), any([]), all([0]), any([[]]), any([[0]]))
  1. A. True False False True True
  2. B. False False False False True
  3. C. True False True False True
  4. D. True False False False True

Correct answer: D. True False False False True

all([]) is True, any([]) is False; all([0]) fails on 0; [] is falsy, but [0] is a non-empty list and so truthy.

More Python Programming questions

Exams that ask this topic