2022.04.01-python学习之打印九九乘法表
1、使用while循环打印九九乘法表
1 i = 1 2 while i < 10: 3 j = 1 4 while j <= i: 5 print("%d * %d = %d" % (j, i, j * i),end="\t") 6 j += 1 7 i += 1 8 print("")
2、使用for循环打印九九乘法表
1 for i in range(1, 10): 2 for j in range(1, i + 1): 3 print("%d * %d = %d" % (j, i, j * i), end="\t") 4 print()