# Allison Obourn
# CSC 110, Spring 2018
# Lecture 20

# This program outputs the difference between consecutive
# temperatures read in from a file

def main():
    file = open("weather.txt")
    contents = file.readlines()

    # convert all temperatures to floating point numbers
    for i in range(len(contents)):
        contents[i] = float(contents[i].strip()) # '33\n' -> '33' -> 33

    # output each change in temperature
    for i in range(len(contents) - 1):
        first = contents[i]
        second = contents[i + 1]
        change = second - first
        print(first, "to", second, "change =", change)
main()
