PYTHON ONLY!!
PLEASE PUT COMMENTS EXPLAINING THE CODE.
Write a program that keeps reading an exam score until a -1 is entered. The program will output the letter grade according to the table below:
Score Grade
90-100 A
80-89 B
70-79 C
60-69 D
< 60 F
For example:
Enter a Score (-1 to Exit): 92
The Letter grade for that score is A.
Enter a Score (-1 to Exit): -1
# Method to get letter grade from score
def letterGrade(score):
if score < 60:
letter = 'F'
elif score < 70:
letter = 'D'
elif score < 80:
letter = 'C'
elif score < 90:
letter = 'B'
else:
letter = 'A'
return letter
def main():
# Reading input
score = int(input("Enter a Score (-1 to Exit): "))
# Checking sentinel value
while score!=-1:
# Printing result
print("The Letter grade for that score is",letterGrade(score)+str("."))
# Reading input
score = int(input("Enter a Score (-1 to Exit): "))
main()



PYTHON ONLY!! PLEASE PUT COMMENTS EXPLAINING THE CODE. Write a program that keeps reading an exam...