# HELP MEEE 6. Just Weight and See

#1

The exercise that I'm stuck on:
6. Just Weight and See

Errors:
Oops, try again. There seems to be something wrong with your code, see the console window for the error message!

``````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]
}

students = [lloyd, alice, tyler]
def average(numbers):
total = sum(numbers)
total = float(total)
total =total / len(numbers)

def get_average(student):
homework = average(student["homework"])
quizzes = average(student["quizzes"])
tests = average(students["tests"]
weighted = ("homework"*.1)+("quizzes"*.3)+("tests"*.6)
return weighted``````

#2

look at the line above:

``tests = average(students["tests"]``

in particular, look at the parentheses. That should fix your current issue

#3

``````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]
}

students = [lloyd, alice, tyler]
def average(numbers):
total = sum(numbers)
total = float(total)
total =total / len(numbers)

def get_average(student):
homework = average(students["homework"])
quizzes = average(students["quizzes"])
tests = average(students["tests"])
weighted = ("homework"*.1)+("quizzes"*.3)+("tests"*.6)
return weighted``````

What??????? I'm confused +_+

#4

Try:

weighted = .1 * homework + .3 * quizzes + .6 * tests

#5

@siik, why? What difference does it make?

@th3b33, here:

``````    homework = average(students["homework"])
quizzes = average(students["quizzes"])
tests = average(students["tests"])``````

students is a list which contains all students. You need to use `student` instead, this is the function parameter and will contain a single student (which is a dictionary), then you can use the keys to get the values

#6

Where?? I don't get it 0-0

#7

#8

did you get it?

#9

I dont know where to put the code

#10

#11

i showed you the lines where you wrongly used students? There are in my reply:

#12

... So I'm supposed to put student names?

#13

you need to use `student` (the function parameter) instead of `students`, see my explanations in that reply

#14

I dont know what the function parameter is...

#15

and im using student now and i dont know what im supposed to do =(

#16

#17

you have one more mistake

see

weighted = ("homework".1)+("quizzes".3)+("tests"*.6)

`homework` ,`quizzes`, `tests` what are these?variable or string?

string need `" "` variable don't

#18

Here is my updated code

``````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]
}

students = [lloyd, alice, tyler]
def average(numbers):
total = sum(numbers)
total = float(total)
total =total / len(numbers)

def get_average(student):
homework = average(student["homework"])
quizzes = average(student["quizzes"])
tests = average(student["tests"])
weighted = ("homework"*.1)+("quizzes"*.3)+("tests"*.6)
return weighted``````

#19

Thanks dude
I just made the changes and it works, here is my updated code

``````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]
}

students = [lloyd, alice, tyler]
def average(numbers):
total = sum(numbers)
total = float(total)
total =total / len(numbers)