Exercise

# Reasons for Modeling: Estimating Relationships

Another common application of modeling is to *compare two data sets* by building models for each, and then *comparing the models*. In this exercise, you are given data for a road trip two cars took together. The cars stopped for gas every 50 miles, but each car did not need to fill up the same amount, because the cars do not have the same fuel efficiency (MPG). Complete the function `efficiency_model(miles, gallons)`

to estimate efficiency as average miles traveled per gallons of fuel consumed. Use the provided dictionaries `car1`

and `car2`

, which both have keys `car['miles']`

and `car['gallons']`

.

Instructions

**100 XP**

- Complete the function definition for
`efficiency_model(miles, gallons)`

. - Use the function to compute the efficiency of the provided cars (dicts
`car1`

,`car2`

). - Store your answers as
`car1['mpg']`

and`car2['mpg']`

. - Complete the following logic statement to print which car (if either) has the best efficiency.