Objective
Create a Python program that calculates the total of an order stored as a JSON list.
Instructions
- Read a line with a JSON list of products. Each product is an object with the keys
name,price(decimal number) andquantity(integer). - Convert it with
json.loadsinto a list of dictionaries. - Calculate the total by adding
price × quantityof each product. - Show
Total: T, with the total to two decimals.
[{"name": "pan", "price": 1.2, "quantity": 3}, {"name": "leche", "price": 0.95, "quantity": 2}]
Total: 5.50
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise