← Back to Functions
Question 343
Discount Over A Hundred
Discount Over A Hundred
Write the bodies of two functions. apply_discount(total: float) -> float returns the total with 10 percent taken off (multiply by 0.9) when the total is above 100, and the total unchanged otherwise. order_total(price: float, quantity: int) -> float multiplies the price by the quantity and returns the result of passing that amount to apply_discount, so one function calls the other. Do NOT write a main block or any top-level test code; the tests construct the calls. Input: two lines, a price then a whole-number quantity, which the tests read and pass to order_total before printing the value it returns with two decimals.
Expected Output:
135.00= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
Functions
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.