Just Weigh and See, Error


def average(numbers):
total = sum(numbers)
total = float(total)

  avg = total/len(numbers)

  return avg

  def get_average(student):
    homework = average(student["homework"]
    quiz = average(student)["quizzes"]
    tests = average(student)["tests"]

fin = homework*0.1   +  quiz*0.3  +  tests*0.6
return fin

I am getting a syntax error, I cant understand what i have done wrong

File "python", line 31
quiz = average(student)["quizzes"]
SyntaxError: invalid syntax



def get_average(student):
homework = average(student["homework"])
pls = average(student["quizzes"])
tests = average(student["tests"])

fin = homework*0.1   +  pls*0.3  +  tests*0.6
return fin

Sorry to waste your time, I messed up with some () brackets


You got the Output without Errors?

I am getting this error

Oops, try again. get_average(alice) raised the following error: global name 'students' is not defined


I'm getting the same problem. Beside that, code works independently.


did you use 'student' as an argument for the get_average function?


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