我的 Python3.x 的开始-2018.8.6

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

第四个程序(基础循环):

1.
count = 0
while True:  
print("count:",count)
count = count +1 #count +=1
if count == 10:
break

2.
for i in range(0,10):
if i <3:
print("loop ",i)
else :
continue
print("hehe...")

3.
for i in range(10):
print('----------',i)
for j in range(10):
print(j)
if j >5:
break
  
执行结果:
1.
count: 0
count: 1
count: 2
count: 3
count: 4
count: 5
count: 6
count: 7
count: 8
count: 9

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

3.
---------- 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










猜你喜欢

转载自www.cnblogs.com/Jie-brunce/p/9434375.html