python define function

>>> def square(x):
...     'calculates the square of the number x.'
...     return x*x
... 
>>> square.__doc__
'calculates the square of the number x.'
>>> help(square)
Help on function square in module __main__:

square(x)
    calculates the square of the number x.

 

posted @ 2019-06-25 08:52  嵌入式实操  阅读(743)  评论(0编辑  收藏  举报