190k views
2 votes
(100 Points) Using Python, do this other problem:

(100 Points) Using Python, do this other problem:-example-1
User Sxingfeng
by
7.1k points

1 Answer

3 votes

1. Write a function that takes the score (integer) as the input and returns the letter grade.

def convert_grade(score):
if score >= 90:
return "A"
elif score >= 80:
return "B"
elif score >= 70:
return "C"
elif score >= 60:
return "D"
else:
return "F"

2. Run the function for the following:
a grade of 92
a grade of 79
a grade of 44

print(convert_grade(92)) # Output: A
print(convert_grade(79)) # Output: C
print(convert_grade(44)) # Output: F

This will print the corresponding letter grade for each score.
User Robert Kirsz
by
8.3k points

No related questions found