While Loops


#1

Good grief, I know Codecademy is free and I appreciate everything they do but why can they not sort out their loop bugs? Using the while loop and its sending Codecademy crazy. It takes about ten minutes to come back wrong and if I return to a previous lesson my code is correct? I was tempted to pay for extra features and perhaps some more intensive training but certainly not now given that Codecademy can not even debug its own programmes. I seen posts dating back to 2014 explaining this problem. Maybe I have it all wrong here but this is pretty off-putting to go ahead with a company that can not even be bothered to maintenance its own platform. Any suggestions to this problem or another platform that manages bugs better?


#2

Do you have a link to the exercise in question?


#3

Can you show us screenshots of the problem(s)? Maybe you have an infinity loop, that will cause a long time before a response come, you can then always attempt to refresh the page and do not wait that long

like @ghostlovescore says, the link to the exercise and a copy of your code would be ideal, then we can look into the issue in more depth, and make a better bug report to solve the problem permanently.

Including the topics you are referring to would also be nice, to get a better picture.


#4

https://www.codecademy.com/courses/learn-python/lessons/loops/exercises/infinite-loops?action=resume_content_item

By the way, if I run the program it crashes the server. While it loops infinitely the community tab produces a white blank window. Sorry I can not provide any more than this.


#5

The loop in the editor has two problems: it’s missing a colon (a syntax error) and count is never incremented (logical error). The latter will result in an infinite loop, so be sure to fix both before running!

@stetim94 Would you do us the honors of infinite looping?


#6

I can not screen screen shot as the server collapses. Its just weird that a problem consistenlty being reported for a number of years is causing such an issue to this day. Maybe the problem is on my side but its been a reoccuring issue.


#7

I ran the exercise with a colon. But it crashes. This is just the exercise I am on.


#8

Can you copy paste your code to the forum before running it?

If the program freezes, refresh the page, don’t wait the whole time


#9

Then it means that you forgot to increment count.

Out of curiosity, could you show us your code? Copy/pasting it here?
And if you could show us the topics that you read, in reference to this issue please? Thank you


#10
num = 1

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

Raw_input was also causing problems too even with python 3 input?


#11

You do have have a infinity loop, the increment is outside the loop. Then you can wait a long time before the code finishes running, because it won’t. I will attempt to print 1 an infinity amount of times

lets focus on one thing at a time, shall we?


#12

We can focus on as many issues as you want moderator.


#13

You should nest the increment of num inside the loop, so the loop condition can becomes false, and you no longer have an infinity loop.


#14

Once you fix your code you should take a gander at this page here Difference between Python2 & Python3.
This helped me when i wanted to learn the difference of python3 while my work only uses Python 2.7.x

I hope this helps you out as well! :slight_smile:

Happy Coding!


#15

I was going to get to that, although a computer can do multi-threading just fine, i found it doesn’t work well for when you try to explain something. Then you are better of in a linear approach, doing one thing at a time.


#16

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