How Is Everybody Doing


Hello, all. New coder here. Working through this exercise and getting the 83.86666 error mentioned in other threads. I've been trying the tips offered in other posts, but can't seem to identify my error.

Oops, try again. Did you remember to print the average of the class? It looks like "83.8666666667" wasn't printed.

Any assistance would be appreciated--thanks!

def get_class_average(students):
    results = []
    for student in students:
    return average(results)
    students = [lloyd, alice, tyler]
    print get_class_average(students)
    print get_letter_grade(get_class_average(students))


These should not be indented ...

    students = [lloyd, alice, tyler]
    print get_class_average(students)
    print get_letter_grade(get_class_average(students))


make sure that copying and running what you've shared reproduces what you describe


Your last three lines are inside the get_class_average() function, and due to the function returning prior to these lines, they are considered "unreachable code". Essentially, the function ends before it reaches them. Simply un-indent those three lines, and you'll be great.


Thank you.

@appylpye -- I tried indenting, but received the same error message

@825orion -- I moved the return statement to the end. It got rid of the numerical error I received before, but I'm now getting:
Oops, try again. One of the following is missing or broken when we tried to use it: alice, lloyd, tyler, students, get_class_average, get_letter_grade



If you are defining students within or after the function, it will not work, since it takes students as a parameter, I believe.


@appylpye and @825orion

Thank you both. I put the rerturn statement back in the original spot after re-reading appylpye's response. It said my last three lines should NOT be indented. After making that adjustment, the code worked.

Thank you both!


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