Add Up the Receipt

Python for AIMedium+10 XP+10

Add Up the Receipt

A café till stores each line of a receipt as a tuple (name, price, quantity). For example, ("tea", 2.5, 2) means two teas at 2.50 each.

Task: write receipt_total(items). Return the total cost of every line, rounded to 2 decimal places.

An empty receipt costs 0.

Examples

items = [("tea", 2.5, 2), ("cake", 3.25, 1)]
returns 8.25
items = []
returns 0

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run