import csv

mostChangeableYear = -1
mostChangeableValue = 0.0
months = ['jan', 'feb', 'mar','apr','may','jun','jul','aug','sep','oct','nov','dec']

with open("temperatures.csv", mode='r') as csvfile:
    reader = csv.DictReader(csvfile)
    for temps in reader:
        coldestValue = 10000.0
        hottestValue = -10000.0
        for month in months:
            if temps[month] != '' and float(temps[month]) < coldestValue:
                coldestValue = float(temps[month])

            if temps[month] != '' and float(temps[month]) > hottestValue:
                hottestValue = float(temps[month])

        temperatureDelta = hottestValue - coldestValue

        if temperatureDelta > mostChangeableValue:
            mostChangeableValue = temperatureDelta
            mostChangeableYear = temps['year']

print("The most changeable year was {0}, with a delta of {1} degrees.".format(mostChangeableYear, mostChangeableValue))