Greater or less than
Just like the equals/not equals operators, when comparing numbers you can check if they are greater or less than each other.
Your toolkit: <, >, <=, >=
Note that the for <=
and >=
the equal sign comes AFTER the <
or >
, kind of similar to the shorthand in the previous assignment.
Complete the code for some practice.
Solution 1
num1 = 12
# Replace the ? with the equality operator to check if num1 is greater than 15"
greater_than_15 = num1 > 15
# Finish the code to check if num1 is less than or equal to 12
less_or_equal_to_12 = num1 <= 12