if i > 95:
print 'a';
elif i == 5:
print 'b';
else:
print 'c';
|
for#
b=100;
for i in range(1, b):
if i > 95:
print 'a';
elif i == 5:
print 'b';
else:
print 'c';
c=['a', 'b', 'c']
for i in c:
print i;
|
while#
d = 1;
while d <= 100:
print d;
d = d+1;
|
function 을 생성한 제어문 예제#
def process_for(num):
for i in range(1, num):
print i;
def process_for_list(list):
for i in list:
print i;
def process_while(num):
while num <= 100:
print num;
num = num+1;
def process_if(value, compareValue, elifValue):
if value == compareValue:
print 'a';
elif value == elifValue:
print 'b';
else:
print 'c';
print '############### for';
process_for(10);
print '############### for_list';
list = ['a', 'b', 'c', 'd', 'e'];
process_for_list(list);
print '############### while';
process_while(95);
print '############### if';
process_if(2, 3, 4);
|
Add new attachment
Only authorized users are allowed to upload new attachments.
«
This page (revision-6) was last changed on
03-Oct-2008 19:20 by DongGukLee