Trouble with dictionaries


#1



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


When i run the code it says that i can't call alice as a object...ive been doing this problem for two hours and i feel really stupid can someone help me out


def average(numbers):
    total = sum(numbers)
    total = float(total)
    return total / len(numbers)
    
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"
        
def student_average(name):
    
    homework = (average(name("homework")) * .1)
    quizzes = (average(name("quizzes")) * .3)
    tests = (average(name("tests")) * .6)
    
    sa = homework + quizzes + tests
    
    return sa

def get_class_average(students):
    results = []
    for item in students:
        results.append(student_average(item))
    return average(results)


#2

this lines:

    homework = (average(name("homework")) * .1)
    quizzes = (average(name("quizzes")) * .3)
    tests = (average(name("tests")) * .6)

homework, quizzes and tests are keys to access the dictionary's. then you should use square bracket ([]), using normal parentheses would make it a function call.


#3

Thanks for the fast response =)


#4

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