# 打印九九乘法表
for i in range(1,10):
for j in range(1,i+1):
# x=i*j
# print(i,'*',j,'=',x,end=' ')
print('%s*%s=%s' %(i,j,i*j),end=' ') # end=' '表示不换行,只是加个空格
print() # 单纯换行
for i in range(1,10):
for j in range(i,10):
print('%s*%s=%2d' %(i,j,i*j),end=' ') # end=' '表示不换行,只是加个空格
print() # 单纯换行
for i in range(1,10):
for k in range(1,i):
print(' ',end=' ')
for j in range(i,10):
print('%s*%s=%2d' %(i,j,i*j),end=' ') # end=' '表示不换行,只是加个空格
print() # 单纯换行
for i in range(1,10):
for k in range(1,10-i):
print(' ',end=' ')
for j in range(1,i+1):
print('%s*%s=%2d' %(i,j,i*j),end=' ') # end=' '表示不换行,只是加个空格
print() # 单纯换行
# 打印金字塔:
for i in range(1,22):
if i%2==0:pass
else:
x='*'*i
print(x.center(22,' '))
max_level = 5
for now_level in range(1,max_level+1):
for i in range(max_level-now_level):
print(' ',end=' ')
for j in range(2*now_level-1):
print('*',end=' ')
print()