Mar-27-2025, 10:50 AM
I am working through the following question as apart of an assignment:
You have been informed that 1 mile is equivalent to 1.61 kilometres.
Based on the given facts create a function called km with a single parameter called miles, (which you can assume will always be a valid number) and returns the equivalent number of kilometres.
Hint: Use 1.61 value while making the conversion: km = miles * 1.61
I have used the following code for this:
You have been informed that 1 mile is equivalent to 1.61 kilometres.
Based on the given facts create a function called km with a single parameter called miles, (which you can assume will always be a valid number) and returns the equivalent number of kilometres.
Hint: Use 1.61 value while making the conversion: km = miles * 1.61
I have used the following code for this:
def km(miles): kilometers = miles * 1.61 return kilometersWhen I submit this for feedback it says that the code is wrong:
Error:Your result was in the wrong type
----------
- You returned type: float
- Expected type: function
I am new to coding in general so any help on this would be really appreciated.