Hi there!

You're on the right track with your code, but I have a few suggestions for you.

- Firstly, in your
`get_class_average()`

function, we need to declare the `students[]`

list outside the function since we need to use it as a parameter.

We can simply add a line that says `students = [lloyd, alice, tyler]`

and your function will expect a list of `dicts`

that contain the needed variables.

- Also, I can't tell from your code without the indentation, but it looks like you're defining your
`get_average()`

function inside your `get_class_average()`

function. Although we can define functions inside other functions, we shouldn't have to do that unless we're doing something *really* funky.

So, check your code and see if you have already defined `get_average()`

somewhere else in your program. If you have, no need to do it again!

If not, let's restructure your code as such:

```
def get_average(student):
#your code
def get_class_average(students):
results = []
#your code
```

It's a good idea to define functions in the order that you use them in your program. For example, `get_class_average()`

utilizes the function `get_average()`

, so we should define `get_average()`

before the other.

Let's take a closer look at your `get_average()`

function first:

```
def get_average(students):
homework=average(students["homework"]) #this line is great!
quizzes=average(students["quizzes"]) #so is this one
test=average(students["tests"]) #this one too :slight_smile:
#these lines can be restructured so we get code that does
#more work for us!
homework=homework*10/100
quizzes=quizzes*30/100
test=test*60/100
return homework+quizzes+test
```

The 4 lines in the end of your `get_average()`

function work, but consider combining them into one return statement like this:

`return 0.1 * homework + 0.3 * quizzes + 0.6 * tests`

Here, we still accomplish the same thing, but we can utilize the order of operations to simplify our code. So, all together we have:

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

Now, your `get_class_average()`

function is on the right track as well, but we need to define it so it iterates over the `students`

list for the required variables.

Let's do this with a `for`

loop:

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

This loop will go through the students in the list and add each student's average to the `results`

list. After, we can simply `return average(results)`

since we've already defined an average function.

After restructuring, we have:

```
students = [lloyd, alice, tyler]
def get_average(student):
homework = average(student["homework"])
quizzes = average(student["quizzes"])
tests = average(student["tests"])
return 0.1 * homework + 0.3 * quizzes + 0.6 * tests
def get_class_average(students):
results = []
for student in students:
results.append(get_average(student))
return average(results)
```

Even though I provided you the answer, please take the time to understand the points I have given you so you can continue to learn and write even better code!

Hope this helps