Return the Total Price
Python
15 pts
Return the Total Price
Define a function total_price(price, quantity) that returns (not prints) the price multiplied by the quantity.
Then print the result of total_price(25, 3) — 3 notebooks at 25 Nakfa each.
Expected output:
75
Checklist
- Define a function called
total_pricewith the parameterspriceandquantity. - Make it give back the price multiplied by the quantity.
- Do not print anything inside the function.
- Print the result of
total_price(25, 3).
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
