Python 条件中的语法错误

Python 条件中的语法错误,python,boolean,syntax-error,Python,Boolean,Syntax Error,在65整数文本之前,=符号出现语法错误。有人能帮我解决一下语法错误吗 age = int(input('Age? ')) if age <= 15 or >= 65: print('Discount Applied.') else: print('Discount ineligible.') 您需要在您的状况中再次指定年龄: age = int(input('Age? ')) if age <= 15 or age >= 65: # ... 我也修改了

在65整数文本之前,=符号出现语法错误。有人能帮我解决一下语法错误吗

age = int(input('Age? '))
if age <= 15 or >= 65:
  print('Discount Applied.')
else:
  print('Discount ineligible.')
您需要在您的状况中再次指定年龄:

age = int(input('Age? '))
if age <= 15 or age >= 65:
    # ...

我也修改了if和else条件,只是为了给OP可能的选项。请在您的回答中澄清这一点,以便采纳您建议的任何人都不会在其代码中引入错误。这是不言自明的。我刚刚改变了条件。对于那些很快准备好答案却没有意识到你已经改变了条件和陈述主体的人来说,这可能并不明显。为安全起见,为什么不在你的问题中这样说呢?
age = int(input('Age? '))
if 15 < age < 65:
     print('Discount ineligible.')
else:
     print('Discount Applied.')