我正在來回奔波,並將自己搞砸在這段代碼上。我有一個公式來計算總膳食價格。使用for循環根據一系列提示百分比計算膳食價格
def total_cost(price,tax,tip):
bill = price+(price*tax)+((price+(price*tax))*tip)
return bill
new_bill = total_cost(15,.08875,.18)
print(new_bill)
從那裏,我怎麼寫一個for循環,計算一餐的總價格,對於不同的臨界率,從15%開始,以1%的增量在25%(包括兩端)的結局?
爲什麼代碼被刪除? – tdelaney