将价格计算器加入列表中
代码示例:
prices = [15, 20, 25, 30] tax_rate = 0.08
def calculate_price(item_price): total_price = item_price + (item_price * tax_rate) return total_price
for price in prices: total = calculate_price(price) print("The total price for item at ${:.2f} is ${:.2f}".format(price, total))