python使用*给出了错误的答案

时间:2017-01-24 13:33:04

标签: python python-3.x

我有一个非常基本的问题:

tip = input("What is the total of your bill? ")
tip = int(tip)

print("At 15% tip, you bill would come to:", tip * 1.15)

print("\nAt 20% tip, you're looking at paying:", tip *1.2)

print("Cheers, have a nice day!")
input("\n\nPress enter to exit")

所以我尝试了这个程序,我输入了50,在20%时它很好,它给出了正确的值。但是在15%时,它给了我57.49999999999999。我做错了吗?

0 个答案:

没有答案