practicepython.in
python exercises
171 exercises

Daily #31 · 29 October 2026

A test that always passes Medium

What does this print?

size = 5
if size == 1 or 2:
    print("small")
else:
    print("large")
  1. ATrue
  2. Braises SyntaxError
  3. Clarge
  4. Dsmall
Show the answer

D: small

Why: Python reads this as (size == 1) or 2, not as “size is 1 or 2”. size == 1 is false, so or gives back 2, and any non-zero number counts as true. Write size == 1 or size == 2, or size in (1, 2).

Play today’s puzzle →