Nested Loop in Python Not Working
<p>I would like to have this output:</p>

<pre><code>* * * 
2 2 2 
4 4 4  
6 6 6 
8 8 8
</code></pre>

<p>I cannot get it and I've tried many ways, but my code doesn't seem to work. Here is my current code:</p>

<pre><code>for row in range(3):
    print ("*", end = " ")
    print ()
    for col in range(2,9,2):
        print (row, end = " ")
        print ()
print()
</code></pre>

<p>What do I do?</p>

<p>I don't see why you are using <code>end</code> in your print statements.  Keep in mind that you must print line by line.  There is no way to print column by column.</p>

<pre><code>print('* * *')
for i in range(2, 9, 2):
    print('{0} {0} {0}'.format(i))
</code></pre>

<p>For further explanation about the <code>{0}</code>s, look up the <code>format</code> method for strings: <a href="https://docs.python.org/2/library/string.html#format-string-syntax" rel="nofollow">https://docs.python.org/2/library/string.html#format-string-syntax</a></p>

python