# Allison Obourn
# CSC 110, Spring 2018
# Lecture 21

# This program reads data from a file in the format
# <Belgian price> <US price> <date>
# This pattern can be repeated any number of times with
# any line breaks.
# outputs the average gas price in Belgium and the
# average gas price in the US
def main():
    file = open("gas_prices.txt")
    lines = file.read()
    lines = lines.split()

    belgian = 0
    american = 0
    for i in range(0, len(lines), 3):
        belgian += float(lines[i])
        american += float(lines[i + 1])
    print("Average Belgian Prices:", belgian / (len(lines) / 3))
    print("Average American Prices:", american / (len(lines) / 3))

main()
