working in class on the vernon data
lines = open('vernon_1850.csv').readlines()
ages = []
for line in lines[1:]:
fields = line.split(',')
age = fields[-1].strip()
ages.append(eval(age))
average = sum(ages) / len(ages)
average
# This is one way to use the built-in python csv
import csv
csvfile = open('vernon_1850.csv')
reader = csv.DictReader(csvfile) # an object that you loop over
ages = [eval(line['age']) for line in reader]
sum(ages) / len(ages)