-
Lambda 함수프로그래밍/Python 2021. 6. 20. 00:59
Lambda
- 함수의 간단화
- Why Use Lambda Functions?
- The power of lambda is better shown when you use them as an anonymous function inside another function.
- Say you have a function definition that takes one argument, and that argument will be multiplied with an unknown number:
예제
# 예제 x = lambda a : a + 10 print(x(5)) x = lambda a, b : a * b print(x(5, 6)) x = lambda a, b, c : a + b + c print(x(5, 6, 2)) # 함수를 리턴하는 함수 구현 가능 def myfunc(n): return lambda a : a * n mydoubler = myfunc(2) print(mydoubler(11))
'프로그래밍 > Python' 카테고리의 다른 글
[Python]_41일차_06.16 (0) 2021.06.17 [오류, 스크랩] Github Sorry, something went wrong. Reload? 오류 해결 방법 (0) 2021.06.08 [python][flask] 웹서버 - 다중 페이지 구현하기 (0) 2021.01.15 [python][flask] 파이썬 + 플라스크로 웹서버에서 hello world 출력하기 (0) 2021.01.14 [Python] sqlite3 + python 데이터베이스 연동하기 (0) 2020.12.30