all() — Python Technical Interview Questions & Answers

all()

all()

  • all() is built into Python. You do not import it. Freshers only need one honest call and the printed result — not a long definition.
  • all() — output: True then False. all True only if every item is true.
  • Wrong type often raises TypeError. Empty values matter for bool/all/any. Don’t mix all up with a similar name (sorted vs sort, int vs float).

Technical Interview Tip: Call all() once and say what prints.

Code Examples for all()

Example

# all()
print(all([True, True]))
print(all([True, False]))

all() — output: True then False. all True only if every item is true.

How to Explain all() to an Interviewer

Explain all() as if you are teaching a junior — definition, then one tiny script.

all() is built-in — no import. One call + exact output.

What does the example print, and why?

all() — output: True then False

What mistake do freshers make with all()?

Wrong type → TypeError.