函数的定义参数传入return的使用函数的说明变量的作用域和global的使用

函数的定义

notion image

参数传入

notion image
可以不用给传入的参数定义类型,直接写就行了

return的使用

notion image

函数的说明

notion image
 

变量的作用域和global的使用

notion image
在函数内部的定义是局部变量,如果想要成为全局变量,在前面加上global关键字