Question: In the file gas _ prices.txt ( linked below ) you will find weekly U . S . gas prices for 1 9 9 4

In the file gas_prices.txt (linked below) you will find weekly U.S. gas prices for 1994 through 2012. The format is :, as follows:
01-03-1994:0.992
01-10-1994:0.995
01-17-1994:1.001
01-24-1994:0.999
01-31-1994:1.005
02-07-1994:1.007
02-14-1994:1.016
02-21-1994:1.009
02-28-1994:1.004
03-07-1994:1.007
...
Write a program that reads this file and outputs a report containing the low price, average price, and high prices for each year, as well as the average prices for each month of each year, sorted by year and month, as follows:
1994:
Low: $0.99, Avg: $1.08, High: $1.17
January $1.00
February $1.01
March $1.01
April $1.03
May $1.05
June $1.08
July $1.11
August $1.15
September $1.14
October $1.11
November $1.12
December $1.13
1995:
Low: $1.11, Avg: $1.16, High: $1.25
January $1.13
February $1.12
March $1.12
April $1.16
May $1.23
June $1.24
July $1.20
August $1.17
September $1.16
October $1.13
November $1.11
December $1.12
...
Redirect your report to a file named gas_report.txt. Submit that file along with your code in a file named gasprices.py
To redirect output from a program to a file, use > in the command line when you run your program, as shown in this example:
python3 gasprices.py > gas_report.tx

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 Databases Questions!