# Just Weight and See: Student Becomes the Teacher

#1

I am getting the error message of ' File "python", line 30
grade = 0.1 * average(student['homework']) +/ 0.3 * average(student['quizzes']) + 0.6 * average(student['tests'])
^
SyntaxError: invalid syntax' for this code. I don't know what I'm doing wrong. Anybody care to explain?

``````lloyd = {
"name": "Lloyd",
"homework": [90.0, 97.0, 75.0, 92.0],
"quizzes": [88.0, 40.0, 94.0],
"tests": [75.0, 90.0]
}
alice = {
"name": "Alice",
"homework": [100.0, 92.0, 98.0, 100.0],
"quizzes": [82.0, 83.0, 91.0],
"tests": [89.0, 97.0]
}
tyler = {
"name": "Tyler",
"homework": [0.0, 87.0, 75.0, 22.0],
"quizzes": [0.0, 75.0, 78.0],
"tests": [100.0, 100.0]
}

def average(numbers):
total = sum(numbers)
total = float(total)
total = float(total) / len(numbers)
def get_average(student):
homework = average(student['homework'])
quizzes = average(student['quizzes'])
tests = average(student['tests'])
grade = 0.1 * average(student['homework']) +/ 0.3 * average(student['quizzes']) + 0.6 * average(student['tests'])
0.6 * average(student['tests'])``````

#2

I'm still getting an error message for the get average portion down

#3

you calculate a student average for homework, quizzes and tests and store this in variables.

why when you define grade, calculate the averages of homework, quizzes and tests again? Why not simply use the variables you defined earlier in the lines above?

there is a division operator here: `+/ 0.3`, why?

If you need more help, post an updated version of your code

#4

Oh I didn't notice that I was using the wrong slash mark

#5

if you need more help, post an updated version of your code using markup:

this makes your indent show on the forum

Part of the Whole (updated)
#6

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