income=float(input("enter the annual income: ")
if income<85528:
tax=(income-556.02)*0.18
else:
tax=(income-85528)*0.32+14839.02
tax=round(tax,0)
print("the tax is: ", tax, "thalers")
为什么它在第2行上总是出现错误?
答案 0 :(得分:3)
第一行中没有括号:“)”。它可以通过以下方式解决:
income = float(input("enter the annual income: "))
完整程序:
income = float(input("enter the annual income: "))
if income < 85528:
tax = (income - 556.02) * 0.18
else:
tax = (income - 85528) * 0.32 + 14839.02
tax = round(tax, 0)
print("the tax is: ", tax, "thalers")
返回:
enter the annual income: 435
the tax is: -22.0 thalers