我想要一个可以告诉我在吃东西时花多少钱的脚本,但我希望能够在运行脚本时输入值(不需要在配置中手动更改)
mealcost = input("How much does the meal cost? ")
taxamount = int(input("What's the tax (%)? "))
tipamount = int(input("What's the tip (%)? "))
print ("meal price: " + "£" + str(mealcost))
print('\n' * 2)
tax = (taxamount / 100)
print ("tax: " + str(taxamount) + "%")
print('\n' * 2)
tip = (tipamount / 100)
print ("tip: " + str(tipamount) + "%")
print('\n' * 3)
#=================================breaks here========================
mealcost = mealcost + mealcost * tax
total = mealcost + mealcost * tip
print ("total")
print("%.2f" % total)
wait = input ()
我不知道该怎么做才能修复它,并且非常感谢有人重新编写它以便它不会破坏。
答案 0 :(得分:1)
git checkout b -b
不会起作用,因为
之后mealcost = mealcost + mealcost * tax
mealcost是mealcost = input("How much does the meal cost? ")
,而不是int / float