728x90
- for 문
for i in range (0, 3, 1) :
print("%d" %i)
'''
결과값:
0
1
2
'''
for i in range(1, 6, 1) :
print("%d " %i, end=" ")
'''
결과값:
1 2 3 4 5
'''
- while 문
i=0
while i < 3 :
print("%d" %i)
i = i + 1
'''
결과값:
0
1
2
'''
for i in range (0, 3, 1) :
print("%d" %i)
'''
결과값:
0
1
2
'''
for i in range(1, 6, 1) :
print("%d " %i, end=" ")
'''
결과값:
1 2 3 4 5
'''
i=0
while i < 3 :
print("%d" %i)
i = i + 1
'''
결과값:
0
1
2
'''