Question: Python 3.0 via PyCharm Purpose: To write a function that performs a subtask and returns an answer. Degree of Difficulty: Easy To determine the fuel

Python 3.0 via PyCharm

Python 3.0 via PyCharm Purpose: To write a function that performs a

Purpose: To write a function that performs a subtask and returns an answer. Degree of Difficulty: Easy To determine the fuel efficiency of a car, in liters per 100 kilometers, the following formula can be used: fuel efficiency- fuel used ( in liters)/distance travelled (in kilometers) x 100 Write a Python function named fuel_efficiency which takes fuel used and distance parameters and returns the corresponding fuel efficency rating. Include an appropriate docstring which states the function's purpose, parameter(s), and return value(s). The code from question 1 contains an example of a docstring Also write a main program that reads the user's fuel used and distance travelled from the console, passes the entered values to the fuel_efficiency function to perform the computation, obtains the function's return value, and then prints a message to the console that reports the user's fuel efficiency rating. Sample Run Here is an example of how your program's console output might look. Green text was entered by the user: blue text came from data returned by the fuel_efficiency function. Calculate Fuel Efficiency Enter the fuel used (liters): 20 Enter distance traveled (km): 400 The fuel efficiency of a car that uses 20.0 liters, and travels 400.0 kms is 5.0 1/100km Tip: You may wish to use the buildin python function round to limit the number of decimal places produced before printing the fuel efficency

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!