파이썬의 람다(Lambda) 함수
2019. 9. 28. 20:15ㆍ파이썬
아래 강의 참조
https://www.youtube.com/watch?v=oL6LIuw_p94&list=PLS8gIc2q83OjStGjdTF2LZtc0vefCAbnX&index=4
C언어의 #define과 같다고 보면된다.
--------------------------------------------------------------------------------------------------
f = lambda x : x + 100
print(f(0)) #결과가 100
print(f(1)) #결과가 101
print(f(2)) #결과가 102
--------------------------------------------------------------------------------------------------
def print_hello():
print("hello python")
def test_lambda(s,t):
print("input1 == ",s,", input2 ==", t)
s = 100
t = 200
fx = lambda x,y: test_lambda(s,t)
fy = lambda x,y: print_hello()
fx(500,1000)
fy(300,600)
'파이썬' 카테고리의 다른 글
numpy iterator (0) | 2019.09.29 |
---|---|
클래스, Exception, with 구문 (0) | 2019.09.28 |
Python 2/3 동시 설치시 선택적으로 버전 사용법(구림 -_-) (0) | 2019.08.21 |
IMAP을 통한 메일 확인 (3) | 2019.04.21 |
SMTP로 메일 보내기(GMail) (0) | 2019.04.21 |