M8) Order status

A web shop shows each order’s status from 2 facts: whether it has been paid, and whether it has been shipped. Table 1 gives the required status for each combination. An order that was shipped without being paid points to a mistake in the warehouse, so staff must check it.

Table 1: Required status for every combination of the 2 facts (Question 1).
Paid Shipped Status
False False Awaiting payment
True False Packing
True True On its way
False True Check order

A programmer wrote the match statement in Listing 1. The pattern _ matches any value.

Listing 1: A match statement for the order status (Question 1).
def order_status(paid: bool, shipped: bool) -> str:
    match (paid, shipped):
        case (False, _):
            return "Awaiting payment"
        case (True, False):
            return "Packing"
        case (True, True):
            return "On its way"
        case (False, True):
            return "Check order"

Which statement about Listing 1 is true?

  1. order_status(False, True) returns "Check order", because that case matches the inputs exactly.
  2. The last case can never run, so assert order_status(False, True) == "Check order" fails.
  3. Python refuses to run the function, because 2 cases match the same inputs.
  4. order_status(True, True) returns "Awaiting payment", because _ matches any value.