def Pyramid(x):#建设一个层数小于20的金字塔
x=int(x)
if x>=20 or x<=0:
return("It's impossible to build!")
else:
for i in range(x):
print(" "*(x-i),"*"*(i*2-1)," "*(x-i))
Pyramid(10)
*
***
*****
*******
*********
***********
*************
***************
*****************
Pyramid(119)
Out[1]: "It's impossible to build!"