9*9乘法表练习

num1 = 1  #顺的9*9的乘法表
while num1 <= 9:
    num2 = 1
    while num2 <= num1:
        print("%d*%d=%d\t"%(num1,num2,num1*num2),end = "")
        num2 += 1
    print()
    num1 += 1
row = 9  #倒的9*9的乘法表
while row > 0:
    col = 1
    while col <= row:
        print(str(row)+"*"+str(col)+"=",row*col, end="  ")
        col += 1
    print()
    row -= 1

猜你喜欢

转载自www.cnblogs.com/rollost/p/10693054.html