I'm writing a programme that calculates the average out of a list of grades and prints it out along with the student's name, but I'm getting a type error when I try to sum all the grades and divide them by the length of the list. This is what I have:

```
def average_grade(afile):
    aline = afile.readline()
    grades = []
    while aline:
        info = aline.split()
        grades = info[1:]
        average = sum(grades) / len(grades)
        print(info[0],average)
        aline = afile.readline()

my_file = open('studentdata.txt','r')

average_grade(my_file)

my_file.close()

```

This is the content of the file:

```
joe 10 15 20 30 40
bill 23 16 19 22
sue 8 22 17 14 32 17 24 21 2 9 11 17
grace 12 28 21 45 26 10
john 14 32 25 16 89

```

This is the error message I'm getting:

```
Traceback (most recent call last):
  File "averagegrade.py", line 13, in <module>
    average_grade(my_file)
  File "averagegrade.py", line 7, in average_grade
    average = sum(grades) / len(grades)
TypeError: unsupported operand type(s) for +: 'int' and 'str'

```

Is it possible to convert everything in `grades` to an integer using list traversal or would I have to write several more lines?