Part of the whole help me


def average(numbers) :
total = sum(numbers)
total = float(total)
number = total / len(numbers)
return number# Add your function below!
def get_average(student):
homework = average(student["homework"])
quizzes = average(student["quizzes"])
tests = average(student["tests"])
return homework * 0.1 + 0.3 * quizzes + 0.6 * tests
def get_letter_grade(score) :
if score == 90 or score > 90 :
return "A"
elif score >=80 :
return "B"
elif score >= 70:
return "C"
elif score >=60 :
return "D"
else :
return "F"
def get_class_average(students):
students = [lloyd , alice ,tyler ]
results = []
for student in students :
return average(results)


get_class_average([alice]) returned 80.55 instead of 91.15 as expected <<< what to doo????


Hi @jiksona ,

Because your code is not formatted, it is difficult for other users to read and debug it. After code is been pasted into the editing window for posting, you can format it by selecting it, and then by clicking the </> button above the editing area. This will enable us to see important details, such as the indentation and underscores.

The result you got is the same as lloyd's average. So, although we cannot see your indentation, we can be pretty sure that the problem is that you indented the following statement too much, which is the final line in your code ...

return average(results)

That excess of indentation made it part of the for loop, so the function returned a result after only lloyd's data had been processed.

To correct the problem, remove one level of indentation from that line.