← 返回 stripe 的题目列表Product Cost Calculation
类型:online_judge
Given a product catalog where each product has a cost and pricing information, design a function to calculate the total cost of the products. If there are no products or the list is empty, return 0.
Example:
Input:
[
{"name": "Product A", "cost": 30.0, "price": 50.0},
{"name": "Product B", "cost": 45.5, "price": 60.0},
{"name": "Product C", "cost": 25.0, "price": 35.0}
]
Output:
100.5
Example
Input
[{"name": "Product A", "cost": 30.0, "price": 50.0}, {"name": "Product B", "cost": 45.5, "price": 60.0}]