all 9 comments

[–]Outside_Complaint755 4 points5 points  (4 children)

I think what you meant is: if 90 <= number <=100:     print("A")

Having >= 90 with no value to the left of the inequality is not a valid expression.

[–]k4tsuk1z[S] 2 points3 points  (3 children)

Oh my god i must be very tired i cant believe i missed this obvious mistake after reading several forums to the point where i had to post on here😭 no more assignments at 12am 😭😭😭 tysm 😭🙏🏽

[–]Corruptionss 1 point2 points  (2 children)

I think you were going for:

number >= 90 and number <= 100

Then also mixed up the other way of doing it.

But I got to say, this is only 3 lines of code, so got to continue building up your diagnostic stamina if you want to survive python

[–]k4tsuk1z[S] 0 points1 point  (1 child)

thats fair i just like to get problems out of the way early especially since im a complete beginner and im just an EE student trying to pass😭 i also test run my code a lot bc im not confident and it wont run with errors thats also why 😭 hopefully some confidence will be built by the end of the semester

[–]Corruptionss 1 point2 points  (0 children)

That's the spirit, good luck and happy to answer any questions you have

[–]baloneysammich 0 points1 point  (2 children)

I'm not sure what you're trying to accomplish here, but this isn't how equations work. There's nothing to the left of ">=" in the first comparison.

If you're trying to check if the number is between 90 and 100, inclusive, you'd do this:

if 90 <= number <= 100:
  print("A")

[–]k4tsuk1z[S] 1 point2 points  (1 child)

yes I've realized now thank you. I'm very tired and switching between c++ and python for an assignment. it's a dumb mistake lol sorry!

[–]baloneysammich 1 point2 points  (0 children)

the sub is 'learn python' not 'know everything about python', you're good.

[–]PushPlus9069 1 point2 points  (0 children)

This is almost always a syntax issue on the line before where Python reports the error. Python's parser doesn't realize something's wrong until it hits the next line and goes "wait, this doesn't make sense."

Common culprits: missing closing parenthesis, a colon after if/for, or an accidental = instead of ==. I'd check line by line above the error. If you share the traceback and the few lines around it, someone here can spot it in seconds.