1.while 循环 :
x = 1 while x < 10: y = 1 while y <=x: print('%d*%d=%2d' % (y,x,x*y),end = '\t') y += 1 x += 1 print('\n')
2.for 循环:
for i in range(1,10): for k in range(1,i+1): #排除结果相同的表达式,如1*2和2*1 print('%d*%d=%2d' % (k,i,i*k),end = '\t') print('\n')