-3

I am getting a syntax error for the = sign prior to the 65 integer literal. Can somebody please help me figure out how to fix the syntax error?

age = int(input('Age? '))
if age <= 15 or >= 65:
  print('Discount Applied.')
else:
  print('Discount ineligible.')
ndmeiri
  • 4,979
  • 12
  • 37
  • 45
SJames10
  • 1
  • 1

2 Answers2

2

You need to specify age again in your condition:

age = int(input('Age? '))
if age <= 15 or age >= 65:
    # ...
ndmeiri
  • 4,979
  • 12
  • 37
  • 45
0
age = int(input('Age? '))
if 15 < age < 65:
     print('Discount ineligible.')
else:
     print('Discount Applied.')
mad_
  • 8,121
  • 2
  • 25
  • 40
  • I have changed the if and else conditions as well just to give OP possible options – mad_ Jun 14 '18 at 16:45
  • Please clarify that in your answer so that anyone who adopts your suggestion doesn't introduce a bug into their code. – ndmeiri Jun 14 '18 at 16:50
  • It is self explanatory. I have just reversed the condition. – mad_ Jun 14 '18 at 16:51
  • It may not be obvious to somebody who ready your answer quickly and doesn't realize that you've switched the condition _and_ the statement bodies. Why not just say that in your question to be safe? – ndmeiri Jun 14 '18 at 16:52