Printing an ASCII diamond with set width in python

前端 未结 7 1690
Happy的楠姐
Happy的楠姐 2020-12-11 13:50

Yes, this is a homework task. But just please, if you\'re going to give me the code please tell me what you\'ve done in detail. I am extremely new to this.

So the ta

7条回答
  •  感情败类
    2020-12-11 14:23

     i=1
     j=input("ENTER NO =")
     l=0
     for i in range(i,j-((j/2)-1),1):
         print (' ' * ((j+1)/2-i)+'*' *(i*2-1))
         l=(j/2+1)
         while  (i==l):
            i=1
            for i in range(i,j,1):
                print (' ' *((i*2)-i)+'*' *(j-i*2))
            if [i==j-1]:
                l=raw_input('')       
    

提交回复
热议问题