字母金字塔

s = 65
h = ' '
a = 10
while a:
    s = chr(s)
    h = h + s
    print(h)
    s = ord(s)
    s = s + 1
    a = a - 1

 

a = 26
s = 65
h = 'A'
u = ' ' * (a + 1)
while a:
    print(u,h)
    s = s + 1
    s = chr(s)
    h = s + h + s
    s = ord(s)
    u = u[1:]
    a = a - 1

 

posted @ 2016-07-25 16:33  疯陈演义  阅读(221)  评论(0编辑  收藏  举报