Increasing / decreasing order

Use strict order: each successive number must be larger or smaller. Equal neighboring values return "Neither".

Write a function that takes three numbers as input and returns "Increasing" if they are in increasing order, "Decreasing" if they are in decreasing order, and “Neither” otherwise.

Complete Listing 1. Save the completed code as check_number_order.py and run it to check the supplied assertions.

Listing 1: Starter function and checks for check_number_order.
def check_number_order(num1: int, num2: int, num3: int) -> str:
    raise NotImplementedError("Replace this line with your code.")


# Each number larger than the one before
got = check_number_order(1, 2, 3)
assert got == "Increasing", f"1, 2, 3: expected 'Increasing', got {got!r}"

# Each number smaller than the one before
got = check_number_order(3, 2, 1)
assert got == "Decreasing", f"3, 2, 1: expected 'Decreasing', got {got!r}"

# Neither order
got = check_number_order(2, 1, 3)
assert got == "Neither", f"2, 1, 3: expected 'Neither', got {got!r}"

# Two equal numbers: not increasing, because 2 is not larger than 2
got = check_number_order(2, 2, 3)
assert got == "Neither", f"2, 2, 3: expected 'Neither', got {got!r}"

# Your case: which three numbers are most likely to break it?
# got = check_number_order(___, ___, ___)
# assert got == "___", f"___: expected '___', got {got!r}"
  • assert condition checks a Boolean condition. A true condition produces no output; a false condition raises AssertionError. For example, assert 2 + 3 == 5 passes.