Question: Step l: Below the comment, # Exercise 2, type these two assignment statements and the function header. (One Imperial gallon is equal to approximately 4.54609

 Step l: Below the comment, \# Exercise 2, type these two

Step l: Below the comment, \# Exercise 2, type these two assignment statements and the function header. (One Imperial gallon is equal to approximately 4.54609 liters and one mile is equal to approximately 1.60934km. Recall that the names of constant values in Python are, by convention, usually written in uppercase, with underscores separating the words.) \[ \begin{array}{l} \text { LITRES_PER_GALLON }=4.54609 \\ \text { KMS_PER_MILE }=1.60934 \\ \text { def convert_to_litres_per_100_km(mpg: float) } ightarrow \text { float: } \end{array} \] Step 2: Use the function design recipe presented in the textbook and lectures to complete the function definition. You've been provided with the function header, but must write a complete docstring and the function body. One docstring example should use the conversion shown above (32 mpg is equivalent to about 8.83 litres per 100km ). 3 Step 3: Save the code, then click Run. Correct any syntax errors. Step 4: Test convert_to_litres_per_100_km by typing call expressions in the shell. What value does the function return when the argument is 32 ? What values does the function return when the argument is a float (32.0 instead of 32) ? For each test, is the actual result (the value returned by the function) equal to the expected result? If necessary, edit the function body and retest until the function passes all the tests

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!