Loops - While you're at it 3/19


#1

Hi,

I tried to work with Learn Python after the update from August 1st. I did a couple of exercises succesfully, but now I’m stuck at 3/19. I tried to run my code, but it keeps loading. I assume that when there is a mistake in the code I will get an error. So I don’t know what’s wrong now!

Can someone help me / advice me?

Thanks in advance!



num = 1

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


#2

you have an infinity loop. That causes it to keep loading and not displaying an error message, here:

num = num+1 # Increment num (make sure to do this!)

increasing num is very important, inside the loop. Given the increment currently happens outside/after the loop, it never happens because the loop is now infinite.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.