Question: Problem A. (10 points) Miles per Gallon calculation Write a program named mpg.py that will calculate a vehicle's miles per gallon. Have the program ask
Problem A. (10 points) Miles per Gallon calculation Write a program named mpg.py that will calculate a vehicle's miles per gallon. Have the program ask a user for starting mileage, ending mileage, and amount of gas consumed (in gallons). Then have it print out the calculated miles per gallon. Here is possible output for your program (user input in bold): Starting mileage: 34050 Ending mileage: 34679 Gas consumed: 1.4 Your vehicle got 20.714285714285715 miles per gallon. Hints: - Notice that we usually measure gas amounts using floating-point values, so make sure to use the float data type
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
