#99乘法表
方法1
'''
for i in range(1,10):
for j in range(1,i+1):
print("%d x %d = %d"%(i,j,i*j),end=" ")
print("")
#实现都打印出来
'''
方法2
a = ""
b = ""
c = ""
d = ""
e = ""
f = ""
g = ""
h = ""
o = ""
for i in range(1,10):
for j in range(1,i+1):
x = ("%d x %d = %d" % (i, j, i * j))
if j==1 :
a =x
elif j==2 :
b=x
elif j==3 :
c = x
elif j==4 :
d =x
elif j==5 :
e=x
elif j==6 :
f = x
elif j==7 :
g =x
elif j==8 :
h=x
elif j==9 :
o = x
print(a, b, c, d, e, f, g, h,o)
方法3
str=""
for i in range(9):
i+=1
for j in range(i):
j += 1
h=i*j
#print(h)
str += (("%dX%d=%d ") % (i, j, h))
if j>=i:
print(str)
str=""
'''