Write a program that keeps reading a test 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
while True: score = float(input("Enter a score (-1 to Exit): ")) if score == -1: break if score >= 90: letter_grade = 'A' elif score >= 80: letter_grade = 'B' elif score >= 70: letter_grade = 'C' elif score >= 60: letter_grade = 'D' else: letter_grade = 'F' print("The letter grade for that score is {}.\n".format(letter_grade))
Get Answers For Free
Most questions answered within 1 hours.