`函数名,参数,处理的各部分位置
·函数名,参数,处理
def testfunc(myname):
print(‘hello %s’%myname)
testfunc(‘xiaoluo’)
hello xiaoluo
`函数可以有多个参数
def testfunc(fname,lname):
print(‘Hello %s%s’%(fname,lname))
testfunc(‘zhang’,‘san’)
Hello zhangsan
·函数可以有返回值
def savings(pocket_money,paper_route,spending):
return pocket_money+paper_route-spending
print(savings(100,50,25))
125
或这样
savings(100,50,25)
125