# Allison Obourn
# CS 115, Autumn 2021
# Lecture 31

# This program reads in birthday data from a file named birthdays.txt
# that is in the same folder as this program. Assumes that the file has
# sets of three values - a month, a day and the number of people born on
# that month and day in a particular year. Computes and prints the number
# of people with birthdays in each month of the year. Months are printed
# in chronological order (January, February, etc)

def main():
    file = open("birthdays.txt")
    data = file.read()
    data = data.split()
    
    # we initially tried to print out our file data but it is too big!
    # If you have this problem, try testing your program with a smaller
    # input file or just loop through your data and print out a small
    # fixed number of values.
    # print(data)

    # a list with 12 spots to hold our counts. The count for January is at
    # index 0, February at index 1, March at index 2, etc.
    counts = [0] * 12

    # we move by 3 values each time so that we can read the month, day and
    # count together. This helps us as we want to do something slightly
    # different with each of them
    for i in range(0, len(data), 3):
        month = int(data[i])
        day = int(data[i + 1])
        count = int(data[i + 2])
        counts[month - 1] += count

    print(counts)

main()
