Objective
Create a Python program that calculates the bill of a coffee shop using a dictionary of prices.
Instructions
- Use this dictionary of prices:
{"coffee": 1.50, "tea": 1.20, "juice": 2.00, "sandwich": 3.50}. - Read an integer
nand thennproducts, one per line. - Add the price of each product that is in the dictionary.
- If a product does not exist, immediately show
Unknown product: Xand do not add it. - At the end show
Total: T, with the total to two decimals.
3
coffee
sandwich
juice
Total: 7.00
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise