# 使用while
i = 1
while i < 10:
j = 1
while j <= i:
print(f"{j} * {i} = {j*i}\t", end='') # \t用于对齐
j += 1
print() # 也可print("\r\n")进行换行
i += 1
# 使用for
for i in range(1, 10):
for j in range(1, i+1):
print(f"{j} * {i} = {j * i}\t", end='')
print()
python 九九乘法表
最新推荐文章于 2024-11-04 21:51:40 发布