Open kangchanguk opened 3 years ago
lambda 인자: 표현식
def hap(x,y): return x+y (lambda x,y:x+y)(10,20)
map(lambda x: x **2, range(5)) [0, 1, 4, 9, 16, 25]
from functools import reduce reduce(lambda x,y: x+y, [0,1,2,3,4])
결과 값: 10
## filter() - filter(함수, 리스트)
list(filter(lambda x: x<5, range(10))) [0,1,2,3,4]
list(filter(lambda x:x%2, range(10)))
lambda
Sample
map()
reduce()
결과 값: 10
list(filter(lambda x: x<5, range(10))) [0,1,2,3,4]
list(filter(lambda x:x%2, range(10)))