Question: In Python please Problem: Gas Prices In this project, you will read a data file named GasPrices.txt , which contains the weekly average prices for
In Python please
Problem: Gas Prices
In this project, you will read a data file named GasPrices.txt which contains the weekly average prices for a gallon of gas in the US beginning on April and ending on August as shown below first few lines of the file contents:
:
:
:
:
:
:
:
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:
MMDDYYYY:price
is the twodigit month, DD is the twodigit day, and YYYY is the fourdigit year.
You are to one or more programsfunctions that read the contents of the file and find the following seperately please and label them:
Average Price Per Year: Calculate the average price of gas per year, for each year in the file.
Average Price Per Month: Calculate the average price of gas for each month in the file.
Highest and Lowest Prices Per Year: For each year in the file, determine the date and amount for the lowest and highest gas prices.
List of Prices, Lowest to Highest: Generate a Text file that lists the date and prices, sorted from the lowest to highest prices.
List of Prices, Highest to Lowest: Generate a Text file that lists the date and prices, sorted from the highest to lowest prices.
Hints: Write one program with each function for separate activities.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
