# 3/19

num = 1

while num<=10:
print(“number is”, num**2)

``````num+=1

it is correct why it display an error
``````

Oops, try again. Make sure you print out all the numbers from 1 to 10 (inclusive).

Hello @yousef_yaht,
Your code wont work because your print line has errors, I think what you want is to make it write “number is 1” “number is 4” and so on, for that to work you need to use %s so it knows what to print. I don’t know if you used %s already but if you haven’t you’ll get it explained later on in another chapter.

The only thing you have to change is the print line.
Before:

``````print("number is", num**2)
``````

After:

``````print "number is %s" % num ** 2
``````

BUT WAIT!
Your code will not be accepted as the instructions weren’t followed. It tells you to just write out the numbers and nothing else.

Right code:

``print num ** 2``
1 Like

This is the code mate.

num = 1

while num <= 10: # Fill in the condition
print num ** 2
num+=1

7 Likes

That is exactly what I’m saying…

Look what I wrote - The only thing you have to change is the print line

1 Like

I’m really new to this stuff but i forget. what does…+=… mean?

Using “+=” is the same as saying “x = x + y”

Example:

for num in blank:
num = num + 2

IS THE SAME AS

for num in blank:
num += 2

whilst that works, you can also use:

num = 1

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

yes its a little cheating, but it works

1 Like