Python函数 发表于 2020-11-28 函数的普通应用12345678910111213def sub(a,b): return a-bdef sumdiff(a,b): return a+b,a-bprint((sub(b=3,a=5)))print(sumdiff(3,5))print(sumdiff(b=3,a=5))##output:2## (8,-2)## (8,2) 123456789101112131415161718192021def f(x): x+=3 print(x)x=5print(f(x))##output:8## Nonedef f(x): x+=3 return xx=5print(f(x))##output:8def f(x): x+=3 return xx=5print(x)##output:5