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.

Test Cases

test greater - Run Test

def test_greater():
    assert greater_than_15 == False

test lessequal - Run Test

def test_lessequal():
    assert less_or_equal_to_12 == True

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
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 = ?