Skip to content

Commit e438647

Browse files
committed
Create d4_exercise_control_flow.py
d4_exercise_control_flow
1 parent 169a64d commit e438647

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#作业1:
2+
###使用python默认的结尾换行符
3+
for x in range(1,10):
4+
for y in range(1,1+x):
5+
print(str(x)+"*"+str(y)+"="+str(x*y),end=" ")
6+
print("")
7+
8+
9+
###将python默认的结尾换行符换为制表符
10+
for x in range(1,10):
11+
for y in range(1,1+x):
12+
print(str(x)+"*"+str(y)+"="+str(x*y),end=" ")
13+
print("",end="\t")
14+
15+
16+
#作业2:
17+
for x in range(1,10):
18+
for y in range(1,1+x):
19+
if x % 2 == 0:
20+
print("",end="\t")
21+
else:
22+
print(str(x)+"*"+str(y)+"="+str(x*y),end="\t")
23+

0 commit comments

Comments
 (0)