Python小代码_1_九九乘法表

Python小代码_1_九九乘法表

max_num = 9
row = 1
while row <= max_num:
    col = 1
    while col <= row:
        print(str(col) + "*" + str(row) + "=" + str(col*row), end="\t")
        col += 1
    row += 1
    print()

 

for i in range(1, 10):
    for j in range(1, i+1):
        print('{0}*{1}={2}'.format(i, j, i*j).ljust(6), end=' ')
    print()

 

posted @ 2018-02-02 15:06  守护窗明守护爱  阅读(204)  评论(0编辑  收藏  举报