Hello, I desprately need help in python with this question. I have tried everything:This is the question:
4.19 LAB: Driving costs - functions
Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles.
Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
print('{:.2f}'.format(your_value))
Ex: If the input is:
20.0
3.1599
the output is:
1.58
7.90
63.20
Your program must define and call the following driving_cost() function. Given input parameters driven_miles, miles_per_gallon, and dollars_per_gallon, the function returns the dollar cost to drive those miles.
Ex: If the function is called with:
50 20.0 3.1599
This is my code:
miles_per_gallon = float(input('miles_per_gallon: '))
dollars_per_gallon = float(input('dollars_per_gallon: '))
dollars_per_mile = dollars_per_gallon/miles_per_gallon
your_value1 = 10 * dollars_per_mile
your_value2 = 50 * dollars_per_mile
your_value3 = 400 * dollars_per_mile
print('{:.2f} {:.2f} {:.2f}'.format(your_value1, your_value2, your_value3))
Can someone tell me what I'm doing incorrectly or show me? Thanks truly.
Lily