九九乘法表
普通那种我就不放上来了
记录一下
def _while(): print("--------------------------------开始了---------------------------------") print("=================================one==================================") i = 1 while i <= 9: j = i while j <= 9: print("{:2}x{}={:<3}".format(i, j, i * j), end='') j += 1 i += 1 print() print("=================================two==================================") i = 1 while i <= 9: j = i k = 1 while i > k: print(" ", end="") k += 1 while j <= 9: print("{:2}x{}={:<3}".format(i, j, i * j), end='') j += 1 i += 1 print() print("--------------------------------结束了---------------------------------") def _for(): print("--------------------------------开始了---------------------------------") print("=================================one==================================") for i in range(1, 10): for j in range(i, 10): print("{:2}x{}={:<3}".format(i, j, i * j), end="") print() print("=================================two==================================") for i in range(1, 10): for k in range(1, i): print(" ", end="") for j in range(i, 10): print("{:2}x{}={:<3}".format(i, j, i * j), end="") print() print("--------------------------------结束了---------------------------------") print("1代表while循环\n2代表for循环") print("请输入你想的循环方式:", end="") m=input() if m=='1': _while() elif m=='2': _for() else: print("操作错误")