Does the below work for the get average question?

def get_average(self):

```
sum = 0
for i in self.grades:
sum += i.score
return sum / len(self.grades)
```

I have no way of testing this as I don’t understand how you call these methods yet

Does the below work for the get average question?

def get_average(self):

```
sum = 0
for i in self.grades:
sum += i.score
return sum / len(self.grades)
```

I have no way of testing this as I don’t understand how you call these methods yet

To test the method, create a Student instance and add some grades. Then call the `get_average()`

method on the instance.

```
avg = pieter.get_average()
```

Now we can pass that as the value of a Grade instance.

`print (Grade(avg).is_passing())`

1 Like

Thanks a lot for the reply. I know coding is very much about working things out for yourself but I was really stuck with this and felt that being shown once would help enormously, just to see how it works. Really appreciate this and think I am starting to understand this more now along with reading Python Crash Course book!

1 Like