🎙 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 3 of 13

Which condition checks that age is between 18 and 30, inclusive?

Which condition checks that age is between 18 and 30, inclusive?

  1. A.18 < age < 30
  2. B.18 <= age <= 30
  3. C.age >= 18 or age <= 30
  4. D.age in (18, 30)
Answer & explanation

Correct answer: 18 <= age <= 30

Chained comparisons with <= include both ends. "or" would accept every age.

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 →