Use two loops to realize 99 multiplication table

The teacher assigned homework and consulted the teacher. Because of the time, I am also careless, so I didn't make it out of the phenomenon, and now I will make up for it.

outer=1#99乘法表从1开始
while outer <10:#定义一个外循环循环9次,构建的是一个9列(或者把<10改成<=9)。
    inner=1#定义从1开始进行计算,每次都从1开始
    while inner <outer +1:#在列表里添加内容如,1*1=1
        print("%d*%d=%d "%(outer ,inner ,outer *inner ),end='')
        inner +=1
    print("\n")
    outer+=1

phenomenon
Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_47514459/article/details/109351069