Part of the Whole Math Issue


#1



https://www.codecademy.com/courses/python-beginner-en-qzsCL/1/4?curriculum_id=4f89dab3d788890003000096


Oops, try again. get_class_average([alice]) returned 83.8666666667 instead of 91.15 as expected


I expected it to get 91.15, since using

print get_average(alice) #both before and after the get_aclass_average(students) function, it returns the right answer. So I don't know what it is IN that function that's killing it, but its only in there.


aclass = ["lloyd", "alice", "tyler"]
print get_average(alice)
 
def get_aclass_average(student):
    results = []
    for student in aclass:
        results = get_average(student)
        results.append(student)
        return average(results)
        
print get_average(alice)


#2

Using that code will result in the submission test saying that the function you were supposed to define is missing altogether. Your code doesn't include a function named get_class_average.
Also, if you use "elephant" as the argument to your function, you'll still get the same result, which raises the question of where it is getting its result from and how it manages to ignore that the argument is "elephant", surely that should crash it with input so different from what it expects


#3

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