26 lines
476 B
Python
26 lines
476 B
Python
# while循环
|
|
|
|
# 第一个循环控制行
|
|
# i = 1
|
|
|
|
# while i <= 9:
|
|
#
|
|
# # 定义内层循环控制变量
|
|
# j = 1
|
|
# while j <= i:
|
|
# print(f"{j}*{i}={i * j}\t", end='')
|
|
# j += 1
|
|
# i += 1
|
|
# print()#输出空内容,用于换行
|
|
|
|
z = 1
|
|
|
|
for z in range(1, 10): # 定义行
|
|
y = 1
|
|
# 通过内层循环控制每一行的数据
|
|
for y in range(1, z + 1):
|
|
print(f"{z}*{y}={z * y}\t", end='')
|
|
y += 1
|
|
z += 1
|
|
print()
|