# Pleas help i need explaination!

#1

Hello Could somebody explain what im doing wrong?

``````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 = float(sum(numbers)) / len(numbers)
def get_average(student):
average(student["homework"], ["quizzes"], "tests")
return 0.10 * "homework"``````

#2

here:

``````def get_average(student):
average(student["homework"], ["quizzes"], "tests")
return 0.10 * "homework"``````

could you explain what you are doing here? Your code is pretty of

#3

``````def get_average(student):
average(student["homework"], ["quizzes"], "tests")
return 0.10 * average(student["homework"]``````

I tryed this now. But still dont understand what im doing wrong could you explain?

#4

that is your code, i am asking you to explain the thought behinds your code, so i can fill in the gaps/blanks

#5

Aahh the function get_average(student) gets the information from students for example homework information from lloyd
i ask python to return 10% multiplyed the homework information right?

#6

here:

``average(student["homework"], ["quizzes"], "tests")``

you give 3 arguments, but the average function has only one parameter, so that won't work. You will need 3 separate function calls.

then you need to calculate the weighted average (10% of this average is homework, 30% is quizzes and 60% is tests), you need to return this value

#7

``````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 = float(sum(numbers)) / len(numbers)
def get_average(student):
average(student["homework"])
return average(student["homework"]) * 0.10 +  average(student["quizzes"])  * 0.30 + average(student["tests"])  * 0.60``````

Hello this works why? could i left the "average(student["homework"])" out of my code? could you maybe explain it so that i understand?

#8

yes, it currently isn't doing anything

Well, you wrote the code, right? What is it particular you don't understand?

#9

I see alot off diffrent methods. What method would you use to solve this question?

Because if i see this Define a function called get_average that takes one argument called student.

I think i need to do this:

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

and after that i dont know what im doing. Or how to use it. Thats what im not understanding hope that you can help

#10

what i would is not relevant, besides, it would included classes (which haven't covered yet)

good step

all this function calls return a value, which we can store in a variable:

``homework = average(student["homework"])``

now that we have variable containing the grade for homework, quizzes and tests, we can move on to calculating the weighted average

#11

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