# 匿名函数 lamdba
name = 'xiaoma' f = lambda x:x+'jun' res = f(name) print('匿名函数的运行结果:',res) 匿名函数的运行结果: xiaomajun
func = lambda x,y,z:x+y+z res = func(10,15,18) print('匿名函数的运行结果:',res) 匿名函数的运行结果: 43 func = lambda x,y,z:(x+2,y+1,z+5) res = func(10,15,18) print('匿名函数的运行结果:',res) 匿名函数的运行结果: (12, 16, 23)
def calc(x): return x+1 res = calc(10) print(res) 11 name = 'xiaoma' def new(x): return name + 'jun' res = new(name) print(res) xiaomajun