Aide in modifying this code removing the ' * ' operator and using while loops instead?
<p>How can I modify my code and remove the ' * ' operator which I have used to multiply strings and use while loops instead of it to produce the same pattern?</p>

<pre><code>i = 1
x = 1
while i &lt;= 4:
    print "v"*x
    print "v"*x
    x = x+1
    i+=1
print "v"*5
b = 4
while b&gt;=1:
    print "v"*b
    print "v"*b
    b=b-1
</code></pre>

<p>Perhaps consider using the <code>range</code> function and a <code>for-loop</code> within your while loop? The <code>range(stop, end)</code> function returns an array with integers from <code>stop</code> (inclusive) to <code>end</code> (exclusive). For ex: <code>range(0,3)</code> returns <code>[0, 1, 2]</code>. So in a <code>for-loop</code>, you could print out <code>x</code> number of v's or <code>b</code> number of v's by printing a v for each member of the array returned from <code>range</code> with each iteration of the outer while loop. For example, it would look like this,</p>

<pre><code>i = 1
x = 1
while i &lt;= 4:
    for y in range(0, x):
        print "v"
        print "v"
    x = x+1
    i+=1
print "v"*5
b = 4
while b&gt;=1:
    for y in range(0, b):
        print "v"
        print "v"
    b=b-1
</code></pre>

python python-2.7 while-loop