7.sending a letter


where does my code go wrong? I get the average score for a student. e.g.. Alice is 91.15, later on I set it to my score and give a grade to my score. my formula keeps returning C for all the averages.

>>> get_average(lloyd)
>>> get_average(tyler)
>>> get_average(alice)
>>> def get_letter_grade(score):
	if score>=90:
		return "A"
	elif score>=80:
		return "B"
	elif score>=70:
		return "C"
	elif score>=60:
		return "D"
		return "F"


Hi @objectplayer39020 ,

What is the purpose of having this statement within your get_letter_grade function? ...



rather than writing get_letter_grade(get_average(alice)) this is supposed to do the work in the get_letter_grade formula itself.


The problem is that the statement causes the function to ignore its score parameter, overwriting it with another value based on an external variable, student. The function should be designed to accept a numerical grade, and Codecademy bases its submission correctness test (SCT) on that expectation. That statement should be removed.

The work of calling the get_average function should be done outside the get_letter_grade function.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.