Question: Write a python program that computes the fuel efficiency of a multi-leg journey. The user will provide the starting odometer reading and then information about

Write a python program that computes the fuel efficiency of a multi-leg journey. The user will provide the starting odometer reading and then information about a series of legs. For each leg, the user provides the current odometer reading, i.e., at the end of the leg, and the amount of gas used. If the amount of gas entered is 0, that leg should be excluded from the calculation. The user signals the end of the trip by entering -1 for the current odometer. The program should display the miles per gallon (MPG) achieved for each leg and for the entire trip. (The MPG should be rounded to two places after the decimal.)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!