------------------------------------函数----------------------------------
------------------------------------定义----------------------------------
"""
def 函数名([参数列表]): ['''文档字符串‘’‘ ] 函数体 [return语句]
"""
1,定义练习
def add(): result = 11+22 print(result)
def add_2(a, b) : result = 11 + 22 print(result)
def add_3(a,b): result = 11 + 22 print(result)
c = a 函数内的参数不能在外部使用
2,调用练习
函数定义以后不会运行,调用才会运行
add() add_2(a=5,b=9) add_2(10,1) add_2(b=10,a=2)
e3 = add_3(10,3)
def add_modify(a,b): result = a+b print(result) def test(): # 在函数中定义函数test() print("我是内层函数") test() # 在函数中调用函数test() add_modify(10,20)