Creating pattern using simple loops?
<p>I am trying to create this pattern in python:</p>

<pre><code>    *
   * *
  * * *
   * *
    * 
</code></pre>

<p>This is my program so far that I've come up with:</p>

<pre><code>ster = "*"
space = " "
lines = 0
n = 3
x = 1
while lines &lt;= 5:
    print space*n, ster*x
    n-= 1
    x+= 1
    lines += 1
</code></pre>

<p>What am I doing wrong?</p>

<p>Thank you for the help, I wrote a functional code for the problem. It was supposed to made using while loop(s).
This is what I did:</p>

<pre><code>width = int(input("Width: "))

i = 1
while i &lt; width*2:
   if i &lt; width:
       print " " * (width-i) + "* " * i
   else:
       print " " * (i-width) + "* " * (2*width-i)

   i = i + 1
</code></pre>

python python-2.7 loops