+ 1
Invalid Sintax
Someone can help me ? I don't know Why python get this error https://code.sololearn.com/cdW8azX7NP77/?ref=app
7 Respuestas
+ 6
First problem: line 4 should begin
elif score not elif grade
Second problem:
If you are testing more than one condition, you have to phrase it like this:
if x > y and x < z
not like this:
if x > y and < z
🙂
+ 4
Instead of doing;
x > y and x < z
Or a similar 'and' operation using the same comparison value on each side of the 'and', you can chain them together like;
y < x < z
and achieve the same result.
def exam_grade(score):
if 100 >= score >= 95:
grade = "Top Score"
elif 94 >= score >= 60:
grade = "Pass"
else:
grade = "Fail"
return grade
+ 2
<=100 is not a valid boolean expression, change it to "score <=100". Same on line 4
+ 1
Thanks a lot!
+ 1
BroFar love u!
0
https://code.sololearn.com/cm6JX4igLpLu/?ref=app
While comparing, the correct syntax is (x< y and x>z) for which you've used a wrong syntax.
Secondly, for elif statement, you've used (elif grade) which should be (elif score)
Hope you'll keep them in check while doing coding in future.. cheers buddy