python -九九乘法表

#九九乘法

# for i in range(1, 10):
# for j in range(1, i+1):
# print('{}x{}={}\t'.format(j, i, i*j), end='')
# print()
row=1
while row <= 9:
col=1
while col <=row:
print('%dx%d=%d'%(row,col,row*col),end=' ') #法1:格式化输出
# print(f'{row}x{col}={row*col}', end=' ') #法2:f 表达式
# print('{}x{}={}\t'.format(col, row, col*row), end='') #法3:format
col+=1
print()
row+=1
posted @ 2024-04-12 17:55  正霜霜儿  阅读(2)  评论(0编辑  收藏  举报