Part of the whole


#1
studnets = [lloyd, alice, tyler]

def average(numbers):
    total = sum(numbers)
    total = float(total)
    average =total / len(numbers)
    return average

def get_average(student):
    homework= average(student["homework"])
    quizzes = average(student["quizzes"])
    test= average(student["tests"])
    score = 0.1 * homework + 0.3 * quizzes+ 0.6*test
    return score
       
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"
    else:
        return "F"
print get_letter_grade(get_average(lloyd))   
 

def get_class_average(students):
    results= []
    for studnet in students:
        print students
        results.append(get_average(studnet))
    print results 
    print average(results)

I am getting the error : get_class_average([alice]) should return a number
what am I doing wrong?


#2

studnets = [lloyd, alice, tyler]

#3

Does not work (with students OR studnets =D). The following error messages appear:


Oops, try again. There seems to be something wrong with your code, see the console window for the error message!


Traceback (most recent call last):
File "python", line 1, in
NameError: name 'lloyd' is not defined


#4

I'm not entirely a python guru but I'm assuming it's due to you not having quotation marks around your array names.


#5

The SCT is expecting a list named students. The members are not to be in quotes since they are identifiers.

Also, instead of printing, use return...

    return average(results)

print get_class_average(students)