Ask coding questions

← Back to all posts
Problem with code
ReginaldTan (0)

Hello, I'm very new to coding in general and was wondering what is wrong with this code. Thank you.

tscore = int(input("score:"))
if tscore >= 200:
print("pass")
else tscore =< 199:
print("fail")

Commentshotnewtop
bossotron13 (64)

tscore = int(input("score:"))
if tscore >= 200:
print("pass")
elif tscore <= 199:
print("fail")

The issue happens because the else is followed by an expression, when you want to do that it would be a elif (else if) the other issue is you had your signs in the wrong places.

You: =<
Correct: <=

I posted the correct code up top but if people that know more than i do can explain it better go ahead :)

Edit: if this helped you, mark it as a answer

Deacon_Cronin (62)

In line four where it says else tscore =< 199 it instead should say else tscore <= 199