""" Felix Muzny DS 2000 Lecture 8 October 1, 2024 Data file (first 12 Boston Fleet games of the PWHL regular season): Opponent names (comma separated) Boston scores (comma separated) Opponent scores (comma separated) Goals for today’s code: Using readline and split, read in the three lines of the CSV file Convert all score values to ints Print out team, boston score, opponent score for all the games """ FILENAME = "boston_fleet.csv" def main(): print("lec 8 - pwhl") # 1. open the file with open(FILENAME, "r") as file: # my file will always just have three lines teams = file.readline().split(",") boston = file.readline().split(",") opponent = file.readline().split(",") # check to make sure they are the same length print("teams:", len(teams)) print("boston:", len(boston)) print("opponent:", len(opponent)) # 2. need to convert all the goals to ints # we can do this simultaneously *because* # the lists are the same length for i in range(len(boston)): boston[i] = int(boston[i]) opponent[i] = int(opponent[i]) # 3. print out the info for each game for i in range(len(boston)): print(teams[i], boston[i], opponent[i]) # extra print for nice formatting print() # if time/extra problems for you to think about!: # celebrate if Boston won # how many total goals did Boston score? # how many games against the Ottowa Charge did Boston win? main()