Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is in Python 100 Section 1 Essential concepts and skills Exercise 3-1 Enhance the Miles Per Gallon program In this exercise, you'll enhance the

image text in transcribed

This is in Python

100 Section 1 Essential concepts and skills Exercise 3-1 Enhance the Miles Per Gallon program In this exercise, you'll enhance the Miles Per Gallon program in figure 3-8 so the console display looks something like this: The Miles Per Gallon program Enter miles driven: Enter gallons of gas used: Enter cost per gallon: 150 15.2 4.25 Miles Per Gallon: Total Gas Cost: Cost Per Mile: 9.87 64.6 0.4 Get entries for another trip (y)? y 225 Enter miles driven: Enter gallons of gas used: 16 Enter cost per gallon: 4.25 Miles Per Gallon: Total Gas Cost: Cost Per Mile: 14.06 68.0 0.3 Get entries for another trip (y)? 1. Start IDLE and open the mpg.py file that's in this folder: murach/python/exercises/ch03 2. Test the program with valid and invalid values. 3. 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. 4. 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions