python学习过程中随手写的测试脚本-testloop.py
生活随笔
收集整理的這篇文章主要介紹了
python学习过程中随手写的测试脚本-testloop.py
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
## 定義list數(shù)組
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')
轉載于:https://www.cnblogs.com/dcbook/p/7516339.html
總結
以上是生活随笔為你收集整理的python学习过程中随手写的测试脚本-testloop.py的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 梦到自己被牛顶是什么意思
- 下一篇: 梦到和妈妈吵架大哭是什么意思