+ 1
Code problem
Why is it displaying error please help me https://code.sololearn.com/cRXbqIb8K0xX/?ref=app
3 Respuestas
+ 2
indentation, marks being a string and your else statement are your major problems.
marks=input()
mark=int(marks)
print ("You have got " + marks + " marks")
if (mark <= 100 and mark >= 90):
print ("Excellent,got an A+")
elif (mark <=89 and mark >=80):
print ("not bad")
make sure you yse tab to indent not space and that they’re consistent. Also its easier to just use a else if statement. But evaluating marks as a string doesnt allow you to compare their numeric values. Create another variable that makes marks an integer then use that.
+ 2
No indentation before print
if (marks <=89 and marks >=80):
print ("not bad")
Edit:input() return a string as pointed out by Roderick ,so convert it to int by int(input())
+ 2
Thanks guys for your support and advice😊😊