3/19


#1

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).


#2

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

#3

This is the code mate.

num = 1

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


#4

That is exactly what I'm saying..

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


#6

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


#7

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


#8

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