I'm not sure what a certain code line does
<p>I was trying to have a program using Python to create a "pyramid" based on a number, n, out of o's and came up with this: ( I would print nn, that would be the lines.)</p>

<pre><code>import time

n = 0
while True:
    n += 2 #just another way to show n=n+2
    nn = n, "o" #nn would be an amount of o's, based on what #n was
    time.sleep(1)
    print (nn, str.center(40, " "))
</code></pre>

<p>Not sure how to make nn the o's and not sure what line 6 does either. Does anyone know the answer to either question? ( I'm not in a class just programming for fun.)</p>

<p>This will be the answer to your question</p>

<pre><code>import time

n = 0
while True:
    n += 2
    nn = n * "o"
    time.sleep(1)
    print (nn.center(40, " "))
    if n &gt; 30:
        break
</code></pre>

<p>The reason why they have put <code>time.sleep(1)</code> is to make it look like an animation. <code>print (nn, str.center(40, " "))</code> this must be changed to <code>nn.center(40, " ")</code> as <code>.center</code> is a method of string. </p>

python