I have this code pasted below, essentially I'm trying to make it loop If the user inputs in an invalid test score(cause lets face it you cant have a negative test score or a score over 100%). So essentially I'm trying to have the program loop if they do enter an invalid score and do so until they enter one that is within the range of 0 to a 100(inclusive).
Code:
A='A'
B="B"
C="C"
D="D"
F="F"
score=float(input("Enter a test score: "))
def determine_grade(score):
while score >= 0 and score < 100:
if score >=90 and score <=100:
print(A)
elif score >=80 and score <=89:
print(B)
elif score >=70 and score <=79:
print(C)
elif score >=60 and score <=69:
print(D)
elif score < 60:
print(F)
return score
score = float(input("Invalid score range, please input it again: "))
determine_grade(score)
so far my output looks like this:
Enter a test score: -2
Invalid score range, please input it again: -2
and then it stops there, I need it to continue to loop until I get a value that's between the 0 and 100(inclusive)