個人 Python3.x 的開始-2018.8.6

  Oh!!!So what!!!continue!!!ide

第四個程序(基礎循環):oop

 
1 count = 0
2 while True:  
3     print("count:",count)
4     count = count +1  #count +=1
5     if count == 10:
6         break
while
 
 1 1.
 2 for i in range(0,10):
 3     if i <3:
 4         print("loop ",i)
 5     else :
 6         continue
 7     print("hehe...")
 8 
 9 2.
10 for i in range(10):
11     print('----------',i)
12     for j in range(10):
13         print(j)
14         if j >5:
15             break  
for Code

 


執行結果:
1.while
count: 0
count: 1
count: 2
count: 3
count: 4
count: 5
count: 6
count: 7
count: 8
count: 9

2.for 1 
loop  0
hehe...
loop  1
hehe...
loop  2
hehe...

3.for 2 
---------- 0
0
1
2
3
4
5
6
---------- 1
0
1
2
3
4
5
6
---------- 2
0
1
2
3
4
5
6
---------- 3
0
1
2
3
4
5
6
---------- 4
0
1
2
3
4
5
6
---------- 5
0
1
2
3
4
5
6
---------- 6
0
1
2
3
4
5
6
---------- 7
0
1
2
3
4
5
6
---------- 8
0
1
2
3
4
5
6
---------- 9
0
1
2
3
4
5
6
View Code
相關文章
相關標籤/搜索