# 3. while you're at it

#1

says I should check for infinite loops?!?!

#2

Hi, @cinpacheco22 ,

In your code, this statement is not indented, so it is not part of the `while` loop ...

``num+=1``

Therefore, `num` is always equal to `1`, which was originally assigned to it, and the loop never terminates.

Indent the statement to make it part of the loop.

#3
``````num = 1

while num <= 10:  # Fill in the condition
print(num**2) # Print num squared
num+=1  # Increment num (make sure to do this!)``````

This should work

#4

also this another approach:

num = 1

while num < 11:
print(num**2)
num += 1

#5

Why parentheses here in print?

#6

If you are running new version of Python, then you would need to use print statement with parenthesis as in print ("Hello, Python!");.

http://www.tutorialspoint.com/python/python_basic_syntax.htm

#7

I don't have to use parentheses... Is there something wrong with that?

#8

Can anyone Explain this?

#9

@lmuellercolostate: Instead of doing `num += num`
You should’ve done

``num += 1``

There’s a huge difference betweent those two.
In the first one, you’ll always get a number equal to two times num, i.e.:

```num = 1 print num #1 num += num # 1 + 1 print num #2 num += num # 2 + 2 print num# 4 ```
While on the second one, you’ll be adding your variable num by a constant, in this case 1.