Python代码计算税率该怎么写
Write a program in Python that calculates the total amount of a meal purchased at a restaurant. The program should ask the user to enter the charge for the food, then calculate the amounts of a 18 percent tip (i.e., charge * tip_rate) and 7 percent sales tax (i.e., charge * tax_rate). Display each of these amounts and the total (i.e., charge + tip + tax).用Python编写一个程序,计算在餐馆购买的饭菜的总金额。该程序应该要求用户输入食物的费用,然后计算出18%的小费(即费用*小费率)和7%的销售税(即费用*税率)的数额,显示这些金额中的每一个和总金额(即费用+小费+税)。 是不是这样的:money = int(input('请输入食物的总金额:'))
taxmoney = money * 0.18
salestax = money * 0.07
print("费用为:" , money)
print("小费:", taxmoney, '元')
print("税款:", salestax, '元')
print("总金额:", money+taxmoney+salestax, '元')
页:
[1]