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: 34079 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 Problem B. (10 points) Time Write a program named time_convert. py that will convert from a time measured in a large number of milliseconds to a time measured in minutes, seconds and milliseconds. Assume that the user is giving measurements in integer amounts. Remember that there are 1000 milliseconds in a second, and 60 seconds in a minute. Here is possible output for your program (user input in bold): Enter time in milliseconds: 124510 2 minutes, 4 seconds, and 510 milliseconds
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
