loops - Grading program in python, stuck on if else statements -


i'm still pretty new python, , have write program user enters homework grades, types 'done' , gets grades back. i'm done it, keep getting error messages when gets loop:

typeerror: unorderable types: str() > int().

print("enter homework scores 1 @ time. type 'done' when done") hwcount = 1 totalscore = 0 strscore = input("enter hw#" + str(hwcount) + " score: ") while strscore != "done":     if ( strscore int , strscore >= 0 , strscore <= 10 ):         totalscore = totalscore + strscore         hwcount = hwcount + 1     elif ( strscore int , strscore < 0 or strscore > 10):     print("please enter number between 0 , 10")     else:         print("please enter whole numbers")     strscore = input("enter hw#" + str(hwcount) + " score: ") 

i tried this:

strscore = int(input("enter hw#" + str(hwcount) + " score: ") 

but print else statement, , got same error before. if me figure out i'd appreciate

strscore string. while loop should this:

while strscore != "done":     try:         score = int(strscore)         if score >= 0 , score <= 10:             totalscore = totalscore + score             hwcount = hwcount + 1         else:             print("please enter number between 0 , 10")     except valueerror:         print("please enter whole numbers or 'done'")     strscore = input("enter hw#" + str(hwcount) + " score: ") 

as show in code, there 3 cases handle - user enters valid score, user enters valid number invalid score, , user enters invalid number. if user enters invalid integer, trying int(strscore) raise valueerror, can catch , report. knowing otherwise score valid int, have check if valid score or not, allowing change elif simple else.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -