# Tipper Program
# User enters the bill total and the program computes two amounts,
# a 15 percent tip and a 20 percent tip
print("ttt ** ** ** ** ** ** ** ** ** **")
print("ntttt Tip Calculator")
print("nttt ** ** ** ** ** ** ** ** ** **")
bill = input("nPlease enter your restaurant's bill total: ")
tip_15 = bill * 0.15
tip_20 = bill * 0.20
float(print("nnA 15% tip for this bill comes out to ", tip_15))
float(print("nA 20% tip for this bill comes out to ", tip_20))
input("nnPress the enter key to exit.")
在我输入账单总数的电话号码后,该应用程序将不断关闭。任何解决此问题的建议?
当您向用户询问输入时,您需要将此值施放为float,然后再将其乘以0.15和0.20
bill = float(input("nPlease enter your restaurant's bill total: "))
以及您的最后2行不应施放到浮点
print("nnA 15% tip for this bill comes out to: ", tip_15)
print("nA 20% tip for this bill comes out to: ", tip_20)