Python/Python Programming
[Python] 람다 함수(Lambda)
Pydole
2018. 4. 29. 00:33
이름없는 한줄짜리 함수. 한 줄의 간단한 함수가 필요한 경우 편리
lambda 인수 : < 구문 >
|
plus = lambda x, y : x + y
print(plus(10, 20))
30
print((lambda x: x * x)(10))
100
func1 = [lambda x, y: x + y,lambda x, y: x - y ]
print(func1[0](5,10))
print(func1[1](5,10))
15
-5