# 8. Part of the whole

#1

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>
Hi,

I’ve been checking all answers in forums here and even copied other user’s code to make mine work, but it keeps showing this error message: “File “python”, line 51 return average(results) SyntaxError: invalid syntax”. I tried changing the identation of the “return” line, I checked character by character for misspells… nothing seems to work. Any idea?
<What do you expect to happen instead?>

```python

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)

def get_average(student):
homework=average(student[“homework”])
quizzes=average(student[“quizzes”])
tests=average(student[“tests”])
return 0.1homework + 0.3quizzes + 0.6*tests

if score > 89:
return “A”
elif 79 < score < 90:
return “B”
elif 69 < score < 80:
return “C”
elif 59 < score < 70:
return “D”
else:
return “F”

students = [lloyd, alice, tyler]
def get_class_average(students):
results =
for student in students:
results.append(get_average(student)
return average(results)

``<do not remove the three backticks above>``

#2

Hi this part

``````def get_class_average(students):
results = []
for student in students:
results.append(get_average(student)
return average(results)
``````

the return statement should be inside the function `get_class_average` not inside the `for loop`.

``````.........
for student in students:
results.append(get_average(student)
return average(results)
``````

then here its missing on `)` for clossing `.append()`

`````` results.append(get_average(student)
``````

#3

Ok, I just realized there was the ) symbol left at the very moment I submitted the topic. Thank you!