Question: can anyone solve this code/lab for me ? Driving is expensive. Write a program with a car's miles/gallon (as float)gas dollars/gallon (as float), the number

can anyone solve this code/lab for me ? can anyone solve this code/lab for me ? Driving is expensive. Write

Driving is expensive. Write a program with a car's miles/gallon (as float)gas dollars/gallon (as float), the number of miles to drive (as int) as input, compute the cost for the trip, and output the cost for the trip. Miles/gallon dolars/gallon and cost are to be printed using two decimal places Note: if milespergallon, dollarspergallon, milestodrive, and trio.cost are the variables in the program then the output can be achieved using the print statement: print(Cost to drive {d} miles at (f} mpg at $(21)/gallon is: ${.21.format(milestodrive, milespergallon dollarspergaton trip.c0)) Ex: If the input is: 21.34 3.15 Then the output is: Cost to drive 50 miles at 21.345 mpg at $ 3.15 / gallon La $ 7.69 Note: Real per mile cost would also include maintenance and depreciation. These are not considered for this problem ACTIVITY 215. 1: LAB: Driving costs (edited) 0/15 main.py 1 Type your code here

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!