본문 바로가기
PYTHON(파이썬)/파이썬 기초

예시로 배우는 파이썬 (제어문-while)

by eplus 2024. 10. 7.

###########################
# Python 기초 8 : 제어문 - while
# eplus(http://www.eiot.co.kr)-나도코딩(YouTube):파이썬 코딩 무료 강의 (기본편) 참조
###########################
# 제어문

c = "토르"
i = 5

while i >= 1:
    print("{0}, 커피가 준비되었습니다. {1}".format(c, i))
    i -=1
    if i == 0:
    print("폐기" )

i = 1
while True:
    print("{0}, 커피가 준비되었습니다. {1}".format(c, i))
    i += 1
    if i ==2:
    break


c = "강"
p = "Unknown"

while p != c :
    print("{0}, 커피가 준비되었습니다. {1}".format(c, i))
    p = input("이름은?")

ePython-08.py
0.00MB

728x90
반응형