'''
打印99乘法表
'''# 正向排序defzhengxv(num:int):for i inrange(1,num+1):for j inrange(1,i+1):if j*i >9:print("{}x{}={}".format(j, i, j*i),end=" ")else:print("{}x{}={} ".format(j, i, j * i), end=" ")print(end="\n")# 反向排序deffanxv(num:int):for m inrange(num,0,-1):for n inrange(m,0,-1):if m * n >9:print("{}x{}={}".format(m, n, m * n), end=" ")else:print("{}x{}={} ".format(m, n, m * n), end=" ")print(end="\n")num =int(input("请输入乘法表位数:"))print("1 正向输出\n2 反向输出")
output_type =int(input("输选择正向/反向输出:"))if output_type ==1:zhengxv(num)elif output_type ==2:fanxv(num)else:print("Error!")