Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAW 6. Fuel Economy A fuel-economy study was carried out for five models of cars. Each car was driven 100 miles, and then the
JAW 6. Fuel Economy A fuel-economy study was carried out for five models of cars. Each car was driven 100 miles, and then the model of the car and the number of gallons used were placed in a line of the file Mileage.txt. Table 5.11 shows the data for the entries of the file. Write a program to display the models and their average miles per gallon in decreasing order with respect to mileage. See Fig. 5.51. The program should create a dictionary of five items, with a key for each model, and a two-tuple for each value. Each two-tuple should be of the form (number of test vehicles for the model, total number of gallons used by the model). TABLE 5.11 Gallons of gasoline used in 100 miles of driving. Model Gal Prius 4.1 Camry 3.8 Sebring 3.9 Mustang 5.2 Gal 2.1 4.1 4.2 5.3 FIGURE 5.51 Model Accord Camry Camry Mustang Model MPG Prius 45.45 Camry 25.00 Sebring 23.81 Accord 23.44 Mustang 19.05 Outcome of Programming Project 6. Model Accord Prius Camry Accord Gal 4.3 2.3 4.2 4.4
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started