Question: Writing Gas Prices code python This project consists of a series of programs to analyze gas prices between April 1 9 9 3 and August

Writing Gas Prices code python
This project consists of a series of programs to analyze gas prices between April 1993 and August 2013.
You will be provided with a text file named GasPrices.txt. The file contains the weekly average prices for
a gallon of gas in the United States, beginning on April 5th,1993, and ending on August 26th,2013.
Figure 8-8 shows an example of the first few lines of the files contents:
Figure 8-8 The GasPrices.txt file
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-YYYY:Price
MM is the two-digit month, DD is the two-digit day, and YYYY is the four-digit year. Price is the average
price per gallon of gas on the specified date.
To get full credit for this project, you must complete programs 1,2 and 3. You will get extra credit for
completing programs 4, and 5(you will get credit for each extra program you complete).
1. Average Price Per Year: Calculate the average price of gas per year, for each year in the file.
(The files data starts in April of 1993, and it ends in August 2013. Use the data that is present
for the years 1993 and 2013). Produce a report showing each year and the average gas price for
that year.
2. Highest and Lowest Prices Per Year: For each year in the file, determine the date and amount
for the lowest price, and the highest price. Produce a report showing for each year, the lowest
price and date on which it occurred and the highest price and the date on which it occurred
(show one year per line).
3. Average Price Per Month: Calculate the average price for each month in the file. Produce a
report that shows each month and year and the average price for that month and year.
4. List of Prices, Lowest to Highest: Generate a text file that lists the dates and prices, sorted from
the lowest price to the highest.
5. List of Prices, Highest to lowest: Generate a text file that lists the dates and prices, sorted from

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!