Built-ins & Standard Library · Question 3 · Easy

any and all are each given a list containing a mix of truthy and falsy values. What is printed?

print(any([0, "", 5]), all([1, 0, 3]))
  1. True False
  2. True True
  3. False False
  4. False True
Answer and explanation

Answer: A. True False

Explanation: any is True if at least one item is truthy, and 5 is. all is True only if every item is truthy, and the 0 in the second list makes it False.

Previous: sorted is called with reverse=True on a list. What does the code print for the… · Next: A program starts with the line import math as m. Which call correctly computes…

Practise built-ins & standard library

Try a fresh set of built-ins & standard library questions with an explanation after every answer, free and without signing up: Built-ins & Standard Library practice. Or sit a full placement mock test.

More built-ins & standard library questions

More python practice

Variables, Types & Operators · Python Strings · Lists & Tuples · Dictionaries & Sets · Conditions & Loops · Functions & Scope · Comprehensions & Generators · Classes & Objects

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge