[root@localhost /]#
[root@localhost /]# cat zlg.py
#!/bin/python
from functools import reduce
a=[1,2,3,4,5,6,7,8,9]
b=[2,3,4,5,6,7,8,9,1]
r=map(lambda x,y:x+y,a,b)
print list(r)
x=3
y=4
print x if x>y else y
p=reduce(lambda x,y:x+y,a,100)
print p
t=filter(lambda x:True if x>5 else False,a)
print list(t)
[root@localhost /]#
[root@localhost /]#
[root@localhost /]# cat zhu.py
#!/bin/python
from functools import reduce
a=[1,2,3,4,5,6]
b=[6,5,4,3,2,1]
hahaha=map(lambda x,y:x+y,a,b)
print list(hahaha)
hehehe=reduce(lambda x,y:x+y,a,100)
print hehehe
hihihi=filter(lambda x:True if x>3 else False,a)
print list(hihihi)
[root@localhost /]#
阅读(12500) | 评论(0) | 转发(0) |