help() function¶Python provides a built-in help() function that shows you how to use other functions. You can check it out in the interactive shell in Thonny like this:
Go ahead and try it yourself on other functions we've used.
To use it with a method, you need to use dot notation with an appropriate object, but as above, just use the name and not parentheses.
help([].index)
You can (and should!) support this with your functions too.
To do it, add a docstring, a multiline comment starting as the first line in your function.
Things typically included:
def f_to_c(fahrenheit_temp):
"""
Convert a temperature from Fahrenheit to its Celsius equivalent.
Paremeters:
fahrenheit_temp: a float, the Fahrenheit temperature to be converted
Returns:
a float, the temperature converted into Celsius
"""
celsius_temp = (fahrenheit_temp-32)*(5/9)
return celsius_temp
help(f_to_c)