python中如何定义函数

如题所述

第1个回答  推荐于2017-09-06
用def关键字,括号里是参数列表
def add(a, b):
return a+b

#下面调用
print add(1, 2)本回答被提问者采纳