This forum is now read-only. Please use our new forums! Go to forums

banner
Close banner
0 points
Submitted by Ralph
almost 11 years

I think that you need to rewrite this section

Why does this not work? You need to rethink your code in the for loop section.

Answer 51a8d32af4b714de9b0009fe

11 votes

Permalink

Yes, editing the code from the previous exercise generates an error. I had the same experience, until I eventually deleted the previous code and coded specifically for this exercise.

Note to Codecademy: this does need to be rectified. I’m sure I’m a lot of people, like me, may have wasted valuable time trying to figure out what they were doing wrong.

Either configure the console to accept changes to the code from the previous exercise or (even better), erase the code from the previous exercise.

Here’s my code for the exercise:

<?php
      // Write your for loop below!
      for ($i = 50; $i >=5; $i -= 5) {
          echo $i . " ";
      }
      ?>
points
Submitted by Simon Latham
almost 11 years

4 comments

Bong Anceno almost 11 years

Passed the section only after copying and pasting the code above. This is a very serious parser problem.

oladan over 10 years

i had the same problem….Passed after using your code Simon! Thanks mate

wilsondc over 10 years

I’ve had several issues with code I know works but will not pass test here. Who ever is writing the code for this needs to realize that there is more than one way to code and it be correct.

张鑫 over 10 years

thanks i didn’t pass this section until i updated my code with yours!:)

Answer 517ac6f3fb38ff1d7400036b

2 votes

Permalink

That should work. That was what I used in my code and it worked just fine. Here is what I used:

points
Submitted by Anthony Armfield
almost 11 years

4 comments

Julijana Seketa almost 11 years

You should maybe put an explanation with your code to help other users what they did wrong and so they understand.

You saved my life. Thank you. I was getting eternally stuck.

Laurent Frileux over 10 years

thanks a lot it worked

D. Philpot over 10 years

thanks for the help, i no i was right with the original code i wrote but since i passed with your code ill take it

Answer 51c775a07c82cace6b0039ac

2 votes

Permalink

I agree that Codecademy needs to get these bugs fixed! I am trying to learn the program not troubleshoot system errors.

This was being discussed a month ago - it should be resolved by now.

points
Submitted by Lisa
almost 11 years

Answer 517988b910763a03130007ee

1 vote

Permalink

I think that I see the issue. When there is an error, the code needs to be reset. It will not run until it is reset. This includes errors from the previous question. You may need to work on your UI a little.

points
Submitted by Ralph
almost 11 years

Answer 51892460969133d78f00019c

0 votes

Permalink

This is mine,

for($i=50;$i > 1; $i-=5){
          echo $i."<br>";
      }

:)

points
Submitted by karen barreto
almost 11 years

Answer 51ce299d282ae3e0d0022e2c

0 votes

Permalink

These buggy excercises are annoying and a really demotivating. That we’re not able to save a certain state of code (like in the past) and everything is done automatically (and wrong!) doesen’t help either … Here I had to copy and quickly hit the button to avoid the quick (and wrong!) error message which didn’t let me do anything to pass the test. :((

points
Submitted by Marcus
almost 11 years

Answer 51effa887c82cad429004bc8

0 votes

Permalink

The code seems to run before pressing the submit button. For this reason, I created an infinite loop before I had the chance to finish writing my code. The solution was to write the code in an outside editor and then paste it in all at once.

points
Submitted by Paul Bartsch
over 10 years