파이썬[Python]: keyword - not 키워드
내장함수 - not 키워드(keyword)
/// 설명
논리값을 부정합니다.(참->거짓, 거짓->참)
※ 형식
not
reference
https://docs.python.org/3/reference/expressions.html#not
※ 형식
not
reference
https://docs.python.org/3/reference/expressions.html#not
/// 예제
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | a = True print(a) # True print(not a) # False b = 'string' print(b) # string print(not b) # False print(not not b) # True c = '' print(c) # print(not c) # True print(not not c) # False d = 1 print(d) # 1 print(not d) # False if b is not c: print('b is string') # b is string else: print('empty') print('b is string' if b is not c else 'empty') # b is string print('s' in 'string') # True print('s' not in 'string') # False print('In' if 's' in 'string' else 'None') # In print('None' if 's' not in 'string' else 'In') # In | cs |
* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)
– 당신을 응원합니다. –
댓글
댓글 쓰기