반응형
    
    
    
  파이썬 제어문 python control-flow
""" Python Control-Flow
    if
    if - else
    for
    while
    break
    continue
"""
print("----- if, if - else")
a = 33
b = 200
if b > a:
    print("b is greater than a")
elif a == b:
    print("a and b equal")
    
print("----- for")
fruits = [ "apple", "banana", "cherry"]    
for x in fruits:
    print(x)
    
print("----- while, break")    
i = 1
while i < 6:
    print(i)    
    if( i == 3 ):
        break
    i += 1
print("----- continue")
i = 0
while i < 6: 
    i += 1   
    if( i == 3 ):
        continue
    print(i)

반응형
    
    
    
  '프로그래밍 > Python' 카테고리의 다른 글
| [PYTHON] 모듈 예제, 모듈 불러오기- 파이썬 (0) | 2023.03.21 | 
|---|---|
| [python] 파이썬 모듈 예제 (0) | 2023.03.21 | 
| [python] google.colab 가져오기 파일에서 Jupyterlab에서 파일의 동일한 동작을 얻는 방법 (0) | 2023.03.14 | 
| [python] Text2Art - https://text2art.com/ (0) | 2023.03.14 | 
| [python] What will be the output? (0) | 2023.03.10 | 
