#Write a function driving_cost()
#with parameters miles_per_gallon, dollars_per_gallon, and miles_driven
#that returns the dollar cost to drive those miles.
#All items are of type float. The function called with arguments (20.0, 3.1599, 50.0) returns 7.89975.
#The main program's inputs are the car's miles per gallon and the price of gas in dollars per gallon (both float).
#Output the gas cost for 10 miles, 50 miles, and 400 miles, by calling your driving_cost() function three times.
#Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
#print(f'{your_value:.2f}')
# Your program must define and call a function:
# def driving_cost(miles_per_gallon, dollars_per_gallon, miles_driven)
def driving_cost(miles_per_gallon, dollars_per_gallon, miles_driven):
return (miles_driven / miles_per_gallon) * dollars_per_gallon
if__name__ == '__main__':
miles_per_gallon = float(input())
dollars_per_gallon = float(input())
driving_cost1 = (10 / miles_per_gallon) * dollars_per_gallon
# number in the parentheses is the miles driven
driving_cost2 = (50 / miles_per_gallon) * dollars_per_gallon
driving_cost3 = (400/ miles_per_gallon) * dollars_per_gallon
print(f'{driving_cost1:.2f}')
print(f'{driving_cost2:.2f}')
print(f'{driving_cost3:.2f}')
To embed this project on your website, copy the following code and paste it into your website's HTML: