简体   繁体   中英

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")

Why does it keep giving an error on line 2?

You have a lacking parenthesis in the 1st line: ")". It can be fixed by:

income = float(input("enter the annual income: "))

Complete program:

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")

Returns:

enter the annual income: 435
the tax is:  -22.0 thalers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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