Question: Add a new function called get_fuel to your Python program. calc_fuel which takes two input parameters: distance fuel_consumption. The function should calculate : fuel_needed =

Add a new function called get_fuel to your Python program.

calc_fuel which takes two input parameters:

distance fuel_consumption.

The function should calculate :

fuel_needed = distance * fuel_consumption / 100.

The function should then return fuel_needed.

Now add the following lines at the end of main():

distance = 500

fuel_rate = 8

fuel = get_fuel(distance, fuel_rate)

print(“Fuel needed is“, fuel)


Step by Step Solution

3.36 Rating (159 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The question seems incomplete because the function name provided at the start getfuel doesnt match w... View full answer

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 Programming Questions!