[python]函数

函数的定义

1
2
3
def 函数名(参数):
函数体
return 返回值

注意事项:

  • 参数如果不需要,可以省略
  • 返回值如果不需要,可以省略
  • 函数必须先定义,后使用