1,左上角三角乘法表
for i in range(1,10):
for j in range(i,10):
k=i*j
print('{}*{}={}'.format(i,j,k),end='\t')
print('\n')
print('\n')
2,左下角三角乘法表
for i in range(1,10):
for j in range(1,i+1):
k=i*j
print('{}*{}={}'.format(j,i,k),end='\t')
print('\n')
print('\n')
3,右上三角乘法表
for i in range(1,10):
for m in range(1,i ):
print(end=' ')
for j in range(i,10):
k=i*j
#print('{}*{}={}'.format(j,i,k),end='\t')
print('%d*%d=%2d' %(i,j,k),end=' ')
print('\n')
print('\n')
4,右下角三角乘法表
for i in range(1,10):
for m in range(1,10-i):
print(end=' ')
for j in range(1,i+1):
k=i*j
#print('{}*{}={}'.format(j,i,k),end='\t')
print('%d*%d=%2d' %(j,i,k),end=' ')
print('\n')
print('\n')