Create a function
Document the function, write a string at the beginning of the function, it will be stored as part of the function, this is called a documentation string, such as
def square(x): 'Caculates the square of the number x.'
return x*x
>>> square.__doc__
'Caculates the square of the number x.'
help -- used in the interactive interpreter will get information about the function including it Document string information, such as
>>> help(square)
Help on function square in module __main__:
square(x)
Caculates the square of the number x.
All functions return Something else: When their return value is not required, they return None.
Parameter Magic
The above is the abstract content of the notes of "Python Basic Tutorial". For more related content, please pay attention to the PHP Chinese website (m.sbmmt.com)!