0

Beginner here. I've posted all code but I believe the error is contained to the two specific lines of code at the bottom in bold. Clearly my syntax is wrong but I can't understand how; I've tried re-specifying INT for numbers and/or putting each side of the OR condition in parentheses, but nothing works. The error marker/pointer on my screen seems to be placed under the greater than/less than symbols. It also throws an error even if I simplify to remove the OR condition.

final_score = str(digit_one) + str(digit_two)
print(f"So the two digit score is {(int(final_score))}")

# 3of3 Final Outputs
**if final_score (<= 10) or (>= 90):**

    print(f"Your score is {final_score}, you go together like coke and mentos.")

**if final_score >= 40 and <= 50:**

    print(f"Your score is {final_score}, you are alright together.")

else:

    print(f"Your score is {final_score}.")
Nick
  • 138,499
  • 22
  • 57
  • 95
  • Does this answer your question? [Determine whether integer is between two other integers](https://stackoverflow.com/questions/13628791/determine-whether-integer-is-between-two-other-integers) – Nick Mar 29 '22 at 23:42
  • Does this answer your question? [Why does checking a variable against multiple values with \`OR\` only check the first value?](https://stackoverflow.com/questions/18212574/why-does-checking-a-variable-against-multiple-values-with-or-only-check-the-fi) – Code-Apprentice Mar 29 '22 at 23:50
  • Similar: https://stackoverflow.com/questions/20002503/why-does-a-x-or-y-or-z-always-evaluate-to-true – Code-Apprentice Mar 29 '22 at 23:51

1 Answers1

0

You just have to repeat the variable before each condition. Besides, python syntax does not requires parentheses. Try this:

if final_score <= 10 or final_score >= 90:
  print(f"Your score is {final_score}, you go together like coke and mentos.")
if final_score >= 40 and final_score <= 50:
  print(f"Your score is {final_score}, you are alright together.")
else:
  print(f"Your score is {final_score}.")
Tiago Cabral
  • 16
  • 1
  • 2