← 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?
- A.18 < age < 30
- B.18 <= age <= 30
- C.age >= 18 or age <= 30
- 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 →