python实现99乘法表4种方位

#coding:utf-8
print("______________________________________")
#左下三角格式输出九九乘法表
for i in range(1, 10):
    for j in range(1, i+1):
        print("%d*%d=%2d" % (j, i, j*i), end="  ")
    print(" ")



print("______________________________________")
#左上三角格式输出九九乘法表
for i in range(1, 10):
    for j in range(i, 10):
        print("%d*%d=%2d" % (i, j, i*j), end="  ")
    print(" ")



print("______________________________________")
#右上三角格式输出九九乘法表
for i in range(1, 10):
     for k in range(1, i):
        print(end="       ")
     for j in range(i, 10):
        print("%d*%d=%2d" % (i, j, i*j), end=" ")
     print(" ")



print("______________________________________")
#右下三角格式输出九九乘法表
for i in range(1, 10):
    for k in range(1, 10-i):
        print(end="       ")
    for j in range(1, i+1):
        print("%d*%d=%2d" % (i, j, i*j), end=" ")
    print(" ")

  

posted @ 2018-04-24 17:45  Joan姐  阅读(2858)  评论(0编辑  收藏  举报