Question: NOTE : Is learning Python programming (currently on chapter 8) with the following textbook: Book Starting Out With Python 3rd Edition by Gaddis
NOTE: Is learning "Python programming" (currently on chapter 8) with the following textbook:
Book "Starting Out With Python" 3rd Edition by Gaddis


2. Use the file named GasPrices.txt. The file contains the weekly average prices for a gallon of gas in the United States, beginning on January 3, 1994 and ending on December 31, 2012. Each line in the file contains the average price for a gallon of gas on a specific date. Each line is formatted in the following way: MM-DD-YYY: Price where MM is the two-digit month, DD is the two-digit day, YYYY is the four-digit year, and Price is the average price per gallon of gas on the specified date. For this program, you are to write a program that reads the contents of the file and performs the following calculation: Average Price Per Year: Calculate the average price of gas per year, for each year in the file (1994 - 2012). Don't forget to keep track of how many records are actually present for a given year
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
