Question
Calculate the Fuel Costs for a Road Trip Fuel Costs We can estimate the cost of fuel for a Road Trip with a given number
Calculate the Fuel Costs for a Road Trip
Fuel Costs
We can estimate the cost of fuel for a Road Trip with a given number of inputs. If we know total miles our Road trip (m), how many miles per gallon our vehicle gets (mpg) and the fuel cost per gallon(CPG), we can estimate total costs for fuel required complete our road trip from point A to point B.
FuelCost = m/mpg * CPG
Where, the terms in the formula are:
m is total miles of the road trip mpg is miles per gallon of vehicle CPG is the cost per gallon for fuel, it is all capitalized because it is a 'Named Constant' (refer to section 2.11).
In our calculation, let's say CPG is set by the government at a fixed price of $6.00 per gallon. This price does not change until the government changes it, so we will used a NAMED_CONSTANT to hold this value, and its value will never change during the lifetime of the running program. By convention NAMED_CONSTANTS are in all CAPS so signify its value never changes once it is initially set.
Write a Python program that
takes input: m, and mpg
Processing: Calculates Fuel Costs (see formula above)
Output: Total miles of road trip, mpg, CPG, and calculated Fuel Costs
10 points] submit FuelCost.py **be sure to format your output to 2 decimal places (Section 2.10).....
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started