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
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
Get step-by-step solutions from verified subject matter experts
