Python Forum
Keyword cannot be an expression
Thread Rating:
  • 2 Vote(s) - 1.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Keyword cannot be an expression
#1
I just started doing a programing course on python and am running into this error with this simple tax calculator . Would anyone be able to explain to me what ive done wrong in as simple as terms as possible ? Thank you in advanced ! Smile

TAXRATE = 0.20
STANDARD_DEDUCTION = 10000.0
DEPENDANT_DEDUCTION = 3000.0

grossIncome = float(input("Enter the gross income"))
numDependants = int(input("Enter the number of dependants"))

taxableIncome = grossIncome - STANDARD_DEDUCTION \
                - DEPENDANT_DEDUCTION * numDependants

incomeTax = taxableIncome * TAX_RATE

print("The income tax is $" = str(incomeTax))
Reply
#2
you have other issues, but this will get you started:

change TAXRATE to TAX_RATE
and
print("The income tax is ${}".format(incomeTax))
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020