#|Python程序-打印单词的菱形字符图案

源程序如下:

a = [1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1] b = [' ' * 2 * (7 - i) + 'Good' * i for i in a] for line in b: print(line)


程序运行结果如下: 【#|Python程序-打印单词的菱形字符图案】Good
GoodGood
GoodGoodGood
GoodGoodGoodGood
GoodGoodGoodGoodGood
GoodGoodGoodGoodGoodGood
GoodGoodGoodGoodGoodGoodGood
GoodGoodGoodGoodGoodGood
GoodGoodGoodGoodGood
GoodGoodGoodGood
GoodGoodGood
GoodGood
Good



    推荐阅读