Bot program to count the products bought in the supermarket. with total sum.
def calculate_total(products): total = 0 for product in products: total += product['price'] return total products = [ {'name': 'bread', 'price': 3}, {'name': 'butter', 'price': 5}, {'name': 'milk', 'price': 4}, {'name': 'eggs', 'price': 2}, ] print(calculate_total(products))