Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
error
#1
marks = input()
if 33 < marks < 45:
    print("pass")
else:
    if 45 < marks < 60:
        print("second")
    else:
        if 60 < marks < 75:
            print("first")
        else:
            if marks > 75:
                print("well_played")
            else:
                print("fail")
could someone please tell me the reason for the error, and please solve that error.
Reply
#2
Im assuming you mean this error?
Error:
Traceback (most recent call last): File "test11.py", line 2, in <module> if 33 < marks < 45: TypeError: '<' not supported between instances of 'int' and 'str'
input() returns a string and you need to convert it to an int first.

int(input())
Recommended Tutorials:
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020