Create a python3 file (or module) called [login to view URL] that contains the following functions. When you run this file, make sure that the main function is invoked.
• Prompts the user for the tank size (in gallons).
• Prompts the user for the miles per gallon.
• Prompts the user for the cost per gallon.
• Invokes the travel function from [login to view URL] with the tank size, miles per gallon, and cost per
gallon as arguments in that order. The string returned from the travel function is displayed on the console. The travel function is described below.
The [login to view URL] File
You will declare two global variables for total distance traveled and net miles traveled. You need to name these two variables total_distance and net_miles, respectively. The list of the parameters and return values for the functions below assume these global variables exist.
[login to view URL] travel function
The travel function is the primary function for the car simulation. All the other functions are called either directly or indirectly from the travel function. The travel function has three parameters: the tank size, the miles per gallon, and the cost per gallon in that order. It should do the following in orderfind_max_distance: Accepts the tank size and miles per gallon as parameters in that order.
Returns the total possible number of miles that could be traveled rounded to two decimal places.
2. user_loop: Accepts the max distance as its parameter. It does not return anything. See its
description in the next section.
3. find_gallons: Accepts the miles per gallon as parameters. This function tries to compute the
number of gallons used given the total distance the car has traveled and the miles per gallon. This computation is done inside a try-except block. If the calculation causes a division by zero error, then an exception will be thrown by the python interpreter. If an exception is thrown, then “MPG is Zero!” is displayed on the console and zero is returned. If an exception is not thrown, then the number of gallons needed (that is, the result of the division) is returned rounded to two decimal places.
4. find_total_cost: Accepts two parameters, the number of gallons and the cost per gallon in that order. Returns the total cost rounded to two decimal places.
5. report_stats: Accepts two parameters which are total cost and number of gallons used in that order. Construct and returns a string. that has the following features. The report_stats function has no print statements in it when you submit it (you might want to have some print statements in it temporarily while debugging)! The format of the string must be identical to the examples in the example runs later in this handout. The features of the returned string are as follows.
• The total miles traveled.
• The net miles traveled.
• The number of gallons used.
• The total cost.
• A message describing the total cost as shown below:
◦ ``Cha Chiiinng!'' if the total cost is less than 25.00 dollars.
◦ ``Wallet getting nervous!'' if the total cost is equal to or greater than 25.00 dollars but
less than 100.00 dollars
◦ ``Ouch!'' if the total cost is 100.00 dollars or more.
9 freelancers are bidding on average $19/hour for this job
I am a Physics graduate with great experience in programming in Python acquired during the career and some research projects. I will do your task in a short time.