Just Weight and See


#1

I don't understand the error...

def get_average(student):
homework = average("homework")
quizzes = average("quizzes")
tests = average("tests")
return (homework*0.1) + (quizzes * 0.3) + (tests * 0.6)

error:

Oops, try again. get_average(alice) raised the following error: unsupported operand type(s) for +: 'int' and 'str


#2

here:

average("homework")

you call your average() function which calculates the averages for a list containing integers/floats, but you pass a string as argument, not a list.

You need to retrieve the student "homework" grades (which are a list), and supply this as argument


#3

thanks for your help


#4

you solved it? Some people struggle with such explanations


#5

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