지속가능티끌/Python

Python. if . 비교연산자, and, or not, in, not in ,

i.got.it 2019. 5. 16. 15:05

 

### 

if a > b: # 마지막에 콜론. 
	... # 들여쓰기 공백 4칸. 

####
if a > b: 
	... 
elif a > c:
	...
else:
	...

############### 비교 연산자들. 
a < b , a <= b, a >= b, a == b, a!=b 

############### and , or , not 
if a < b and c > d:
	...

if a < b or c > d:
	...

if not a < b:  # if a >= b 와 같은 의미. 
	...


############### in , not in 
arr = [1, 2, 3, 4]

if 100 in arr: # 100 이 arr 에 있다면 
	... 

if 100 not in arr: # 100 이 arr 에 없다면 
	... 

 

 

 

 

 

 

 

 

 


첫등록 : 2019년 5월16일 

최종수정 : 

 

본 글 단축주소 : https://igotit.tistory.com/2173