左下
for i in range(1, 10): for j in range(1, i+1): print("{0}*{1}={2}".format(i, j, i * j), end = "\t") print("")
右上
for i in range(1, 10): for j in range(1, i): print(end = "\t\t") # 没有end就会自动换行了 for k in range(i, 10): print(str.format("{}*{}={}", i, k, i * k), end = "\t") print("")
全部
法一:
for i in range(1, 10): for j in range(1, 10): print("{}*{}={}".format(i, j, i * j), end = "\t") print("")
法二:
for i in range(1, 10): s = "" for j in range(1, 10): s += str.format("{}*{}={:<4}", i, j, i * j) print(s)