1.案例代码:
# 乘法口诀2111440
for i in range(1,10):
for j in range(1,i+1):
print(i,"*",j,"=",i*j,"\t",end="")
print()
1. 案例运行结果:
2.案例代码:
# 乘法口诀2111440
for i in range(1,10):
for j in range(i,10):
print(i,"*",j,"=",i*j,"\t",end="")
print()
2.案例运行结果:
3.案例代码:
#九九乘法表2111440
for i in range(1,10):
for k in range(i-1):
print("\t"," ",end="")
for j in range(i,10):
if(i*j<10):
print(i,"*",j,"= ",i*j,"\t",end="")
else:
print(i,"*",j,"=",i*j,"\t",end="")
print()
3.案例运行结果:
4.案例代码:
#九九乘法表 2111440
for i in range(1,10):
for k in range(9-i):
print("\t"," ",end="")
for j in range(1,i+1):
if(i*j<10):
print(i,"*",j,"= ",i*j,"\t",end="")
else:
print(i,"*",j,"=",i*j,"\t",end="")
print()
4.案例运行结果: