Skip to content

Commit 137d5f2

Browse files
committed
Create d4_exercise_control_flow.py
1 parent e4430e4 commit 137d5f2

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Spyder Editor
4+
5+
This is a temporary script file.
6+
"""
7+
8+
for i in range (1,10):
9+
for j in range(1,10):
10+
print(i,"*",j,"=",i*j,"\t",end="")
11+
if i==j:
12+
print("")
13+
break
14+
15+
i=0
16+
j=0
17+
while i<9:
18+
i+=1
19+
if i%2==0:#i等于偶数不执行后续代码
20+
continue
21+
while j<9:
22+
j+=1
23+
print(i,"*",j,"=",i*j,"\t",end="")
24+
if i==j:
25+
j=0
26+
print("")
27+
break
28+
29+
30+

0 commit comments

Comments
 (0)