Asterisk art in python

前端 未结 5 1107
遇见更好的自我
遇见更好的自我 2020-12-20 21:10

I would like to produce this picture in python!

         *
        **
       ***
      ****
     *****
    ******
   *******
  ********
 *********
**********         


        
5条回答
  •  悲哀的现实
    2020-12-20 21:56

    It's because of the operator precedence, use this one:

    x=1
    while x<10:
     print '%10s' % ('*'*x)
     x=x+1
    

提交回复
热议问题