a = list(map(str,[1,2,3,4,5,6]))
print(list(map(str,[1,2,3,4,5,6])))
print(map(str,[1,2,3,4,5,6]))
print(a)
from functools import reduce
def add(x,y):
return x + y
print(add,[2,2,2])
print(reduce(add,[1,1,1,1,1,1]))
print(sorted([9,4,2,5,7,23,-4,-23,-44],key=abs))
def ex_add(*args):
def add():
ax = 0
for n in args:
print('?')
ax = ax + n
print('|')
return ax
return add
k = ex_add(5,1,2,3,4)
print(k)
print(k())
f = lambda x: x*x
print(f)
print(f(3))
# def build(x,y):
# return lambda : x*x+y*y
# print(build(1,2))
# print(build(1,2))
显示
['1', '2', '3', '4', '5', '6']
<map object at 0x00360B90>
['1', '2', '3', '4', '5', '6']
<function add at 0x00361C00> [2, 2, 2]
6
[2, 4, -4, 5, 7, 9, 23, -23, -44]
<function ex_add.<locals>.add at 0x00361ED0>
?
|
?
|
?
|
?
|
?
|
15
<function <lambda> at 0x00637E40>
9
<function build.<locals>.<lambda> at 0x00637ED0>
<function build.<locals>.<lambda> at 0x00637ED0>