Question: The Miles Per Gallon program Enter miles driven: } 1 5 Enter gallons of gas used: 1 5 . 2 Enter cost per gallon: 4
The Miles Per Gallon program
Enter miles driven:
Enter gallons of gas used:
Enter cost per gallon:
Miles Per Gallon:
Total Gas Cost:
Cost Per Mile:
Get entries for another trip yn y
Enter miles driven:
Enter gallons of gas used:
Enter cost per gallon:
Miles Per Gallon:
Total Gas Cost:
Cost Per Mile:
Get entries for another trip yn
Start IDLE and open the
mpgpy file that's in this folder:
murachpythonexercisesch
Test the program with valid and invalid values.
Enhance the program so it lets the user repeat the entries and get the miles per
gallon for more than one trip. To do that, use a while loop.
Modify this program so it gets the cost of a gallon of gas as another entry
from the user, and validate this entry before using it in your calculations. If all
three entries are valid, calculate the total gas cost and the cost per mile, and
display the results on the console.
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
