函数的作用域
name='111'
def foo():
name='222'
def bar():
name='333'
print(name)
def tt():
print(name)
return tt
return bar
r1 = foo()
r2 = r1()
r3 = r2() 333
foo()()() 333
func=lambda x:x+1
print(func(10))
map,filter,reduce函数
msg='linhaifeng'
print(list(map(lambda x:x.upper(),msg)))
movie_people=['ab','bb','cd','db']
print(filter(lambda n:not n.endswith('sb'),movie_people))
res=filter(lambda n:not n.endswith('b'),movie_people)
print(list(res))
from functools import reduce
num_l=[1,2,3,100]
print(reduce(lambda x,y:x+y,num_l,1))
print(reduce(lambda x,y:x+y,num_l))