# basics conditionals

Chained Comparisons

Python has a neat shortcut for checking whether a number falls in a range — you can chain comparisons together, just like in math class:

if 1 <= x <= 10:
    print("In range!")

This means "x is between 1 and 10" — no and needed.

Your turn: read a number grade. Print Valid grade if grade is between 1 and 12 (inclusive) using a chained comparison, otherwise print Invalid grade.

💡 need a hint?

pyb-cond-chained.py🔒 given lines are locked — write your code in between
loading...