繁体   English   中英

SyntaxError:无效的语法,python3

[英]SyntaxError: invalid syntax, python3

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 行给出错误?

您在第一行缺少括号:“)”。 它可以通过以下方式修复:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM