Python Script to calculate averages

I'm fairly new to python so bare with me. I'm trying to write a script that would calculate my class average from exams. The script will look at a text file formatted like this:

Calculus 95 90 92
Physics 80 85 92
History 90 82 83 95

The output should look like this:

Calculus 92.33
Physics 85.66
History 87.5

I have the following code:

#!/usr/bin/python
import math

f = open('exams',"r")

l = f.readline()
while l :
 l = l.split(None,10)
 L = l[1:]
 print l[:1]
 print L
 print 'Number of Values ', len(L)
 l = f.readline()

The code above pretty much takes each row and turns it into an array. The L variable determines how many grades are in (doesn't look for the subject). I planned on summing the grades and dividing by 'L.' Another problem is that when the text is in the array, it's handled as a string and not as integers/floats.

Anyone have any suggestions?

does this do what you want?

#!/usr/bin/python
import math

f = open('exams.txt','r')
total = []

while True :
    try:
        l = f.readline().split(None,10)
        L = float(''.join(l[1:]))
        print l[:1], L
        total.append(L)
    except ValueError:
        average = sum(total)/len(total)
        print 'Average is: ', average
        break

Another solution:

f = open("exams","r")

l = f.readline()
while l:
    l = l.split(" ")
    values = l[1:]
    
    sum = 0.0
    for v in values:
        sum += float(v)
    
    print "%s %f" % (l[0] , sum / len(values))
    
    l = f.readline()
    
f.close()

And the output:

Calculus 92.333333
Physics 85.666667
History 87.500000