Write a function total_cost(cart) that takes a shopping cart given as a list of
(quantity, price) tuples and returns the total cost, that is the sum of
quantity * price over every item. An empty cart costs 0. Use a comprehension rather
than an explicit loop.
Example
total_cost([(2, 10), (1, 5)]) -> 25
Implement this function:
def total_cost(cart: list):
Write the function only — the arguments are read for you and the return value is printed automatically.
Arguments arrive as one Python literal per line, in this order: cart.
Input
[(2, 10), (1, 5)]
Output
25