首页 > 代码库 > python 编程实例 7

python 编程实例 7

#python 100 例 9.py

#用*打印出一个棱形



a = int(input("biangchang: "))

#获取由几个* 边长的棱形

i = 1

j = 1

while i<a+1:

    print ("   "*(a-i)," * "*(2*i-1))


    i = i+1


while j<a+1:    

    print ("   "*j," * "*(2*(a-j)-1))

    j = j+1


本文出自 “星河码头” 博客,请务必保留此出处http://liy607.blog.51cto.com/2892862/1438067