Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 ? image text in transcribed
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

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

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions