Loading...
Loading...
Loading...
An online shop charges a delivery fee of 50, but the fee is waived when the subtotal (price times quantity) is 1000 or more. Write total(price, quantity, fee=50) that returns the amount to pay, and print it.
Example 1
Input
300 2
Output
650
Subtotal 600, so the fee is added: 650.
Example 2
Input
500 2
Output
1000
Subtotal exactly 1000, so no fee.
Try the problem first. Open one hint at a time.
Work out the subtotal first, then decide whether to add fee.
fee=50 in the def line is a default argument, so the caller can leave it out.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor