【发布时间】:2021-12-27 05:10:02
【问题描述】:
if number <10 and >90:
print(f"Your score is {number}, you go together like coke and mentos.")
elif number >= 40 and <= 50:
print(f"Your score is {number}, you are alright together.")
else:
print(f"Your score is {number}.")
File "main.py", line 34
if number <10 and >90:
^
SyntaxError: invalid syntax
我对学习 Python 非常陌生,我不明白为什么会出现错误。任何帮助表示赞赏。
编辑:感谢您的帮助。是的,我不小心在第一条语句中输入了“and”而不是“or”。问题是我没有把变量名放在每个 >/<.>
【问题讨论】:
-
你的号码怎么会同时小于10和大于90?