# 九九乘法表
for i in range(1, 10):
for j in range(1, i+1):
print('{}x{}={} '.format(j, i, i*j), end='')
print()
#三角形
for i in range(10): for j in range(0,i): print("-",end=" ") for j in range(i,10): print("$", end=" ") print("") print("-------------------------")
for i in range(10):
for j in range(0, 10 - i):
print("-", end=" ")
for k in range(10 - i, 10):
print("$", end=" ")
print("")
打印上三角,只需要将"-"去掉
for i in range(10):
for j in range(0, 10 - i):
print(end=" ")
for k in range(10 - i, 10):
print("$", end=" ")
print("")
打印倒三角,只需要将"-",去掉
for i in range(10):
for j in range(0,i):
print(end=" ")
for j in range(i,10):
print("$", end=" ")
print("")