반응형
python for
1.소스
print "\ntype 1" for counter in range( 3 ) : print "type 1 %d" % counter print "\ntype 2" for counter in range(0 , 3 ) : print "type 2 %d" % counter print "\ntype 3" for counter in range( 0, 3, 1) : print "type 3 %d" % counter print "\ntype 4" for counter in range( 3, 1, -1 ) : print "type 3 %d" % counter
결과
hacker@ubuntu:~/python$ python for1.py type 1 type 1 0 type 1 1 type 1 2 type 2 type 2 0 type 2 1 type 2 2 type 3 type 3 0 type 3 1 type 3 2 type 4 type 3 3 type 3 2
반응형
'Python' 카테고리의 다른 글
dir (0) | 2016.07.21 |
---|---|
random (0) | 2016.07.21 |
python while 문 (0) | 2016.07.21 |
if 문 (0) | 2016.07.21 |
사용자 입력 받기 raw_input (0) | 2016.07.21 |