🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Python Conditions: all 13 questions

Quiz: Python Conditions · Question 2 of 13

What does this print? (code)

What does this print?

n = 0
print("yes" if n else "no")
  1. A.yes
  2. B.no
  3. C.0
  4. D.Error
Answer & explanation

Correct answer: no

0 is falsy, so the else part runs.

Can you get the rest right without peeking?

Take the timed Quiz: Python Conditions quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →