python 金字塔图形

a = 50
y = '*'*(a+1)
p = ' '

while a:
    
    print(y)
    y = y[:a-1]
    y = p  + y
    a = a - 1
   

 

for i in range(20): 
    print(' ' * (20-i-1) + '*' * (2*i+1) )

 

a = 20
p = ' '*(a+1)
s = '*'
b = 1

while a:
    t = p + s*b

    print(t)

    t = t + s*2 
    
    t = t[1:]

    b = b + 2
    p = p[1:]
   
    a = a - 1

 

posted @ 2016-06-26 19:13  疯陈演义  阅读(2136)  评论(0编辑  收藏  举报