Help! Just Wait and See


#1

This is the last part of my code:

def get_average(student):
students_name={"alice","tyler","lloyd"}
for student in students_name:
homework=average(student["homework"])
quizzes=average(student["quizzes"])
tests=average(student["tests"])
grade=0.1*homework+0.3*quizzes+0.6*tests
print grade

But it warns me that:get_average(alice) raised the following error: string indices must be integers, not str
I cannot get the meaning of it.


#2

get_average should calculate the average grade for a single student (student the function parameter)


#3

It is a single one. It is calculated as single in my code...


#4

no, you made a unnecassery faulty dictionary and a loop you don't need


#5

Now, you see, I make these change:

def get_average(alice):
homework=average(alice["homework"])
quizzes=average(alice["quizzes"])
tests=average(alice["tests"])
grade=0.1*homework+0.3*quizzes+0.6*tests
print grade

But it still warns I'm wrong


#6

you need to return the grade


#7

It just drives me crazy! I didn't realize that it asks me to "return" rather than "print". Thank you for your time.


#8