파이썬 반복문,조건문(수정중)
카테고리 없음 2016. 4. 13. 15:14 |파이썬 반복문,조건문
if 조건문 표현식
if(expression):
(command)
elif(expression):
(command)
else:
(command)
예)
if x < 0:
x = 0
print 'negative change to Zero'
elif x==0:
print 'zero'
elif x==1:
print 'single'
elif x==2:
print 'double'
else :
print 'more'
while 조건문 표현식
while i < 6:
print "At the top i is %d' %i
while i >2:
print 'Right now i is %d%'%i
Loop문 (for)표현식
for (Y) in (X) :
(command)