202k views
2 votes
Assume that the final grade for a course is determined based on this scale - A: 900 points, B: 800-899 points, C: 700-799 points, D: 600-699 points, F: 599 or fewer points. Write a function named get_letter_grade() that takes the number of points the student has earned as a parameter. It should return a string containing (only) the letter grade the student will receive.

User Sorenbs
by
4.3k points

1 Answer

3 votes

Answer:

In Python:

def get_letter_grade(points):

if points>=900:

grade ="A"

elif points>=800 and points < 900:

grade ="B"

elif points>=700 and points < 800:

grade ="C"

elif points>=600 and points < 700:

grade ="D"

else:

grade = "F"

return grade

Step-by-step explanation:

This defines the function

def get_letter_grade(points):

The following if-else if conditions check the score to determine the appropriate grade

if points>=900:

grade ="A"

elif points>=800 and points < 900:

grade ="B"

elif points>=700 and points < 800:

grade ="C"

elif points>=600 and points < 700:

grade ="D"

else:

grade = "F"

This returns the grade

return grade

User Michael Shimmins
by
4.5k points