teambook

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

## 定义list数组
lstrs = ['t1','t2','t3','t4']
print('lstrs is',lstrs)

i = 0
## test for loop
for lstr in lstrs:
print('lstrs[%d] is' % i,lstr )
i = i + 1
print('end for loop')

j = 0
## test while loop
while j <= 3:
print('lstrs[%d] is' % j,lstrs[j] )
j = j + 1
print('end while loop')

k = 0
## test break and continue
print('k=0 , k<=10 ,1 continue, k>=4 break')
while k <= 10:
if k == 1:
k = k + 1
continue
print('k is %d' % k)
if k >= 4:
break
k = k + 1
print('end test for break and continue')

posted on 2017-09-13 18:01  teambook  阅读(164)  评论(0)    收藏  举报