Python While Loops Asterisk
<p>Re-type and run, note incorrect behavior. Then fix errors in the code, which should print num_stars asterisks.</p>

<pre><code>while num_printed != num_stars:
    print('*')
</code></pre>

<p>Below is the code which I have entered. I am getting an infinite loop hence no answer. Please help me out! Thanks!</p>

<pre><code>num_stars = 3

num_printed = 0

while(num_printed != num_stars):

    print(num_stars*'*')
</code></pre>

<p>You'll want either:</p>

<pre><code>num_stars = 3
print(num_stars * '*')
</code></pre>

<p>or:</p>

<pre><code>num_stars = 3
num_printed = 0
while(num_printed &lt; num_stars):
    print('*')
    num_printed += 1
</code></pre>

<p>Depending on what you're trying to do.</p>

python loops while-loop