while True 死循環


 1 while True 死循環示例:
 2 
 3 count = 0                                    #給count設置變量為0
 4 while True:
 5     count += 1                                #每循環一次,count+1  ; count += 1 等同於count = count+1  意思是一樣的
 6     if count >=50 and count <=60:            #對比count的值,設置循環中50-60之間的字符不打印
 7         continue                            #如果條件匹配,到這里就不往下執行了,continue回到起點
 8     print ("張江華",count)                    #打印,count 輸出打印的次數
 9     if count ==100:                            #循環如果到100次,就跳出循環
10         print ("已經循環夠了100次,退出循環!")
11         break

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM