I got the correct code but it won't let me pass

It works! Thank you. I should have only update the page in browser. Always forget the simplest way. Just reset.

1 Like

this is what i came up with and it worked. my first mistake was not entering the code onder the isntructions like the first piece of code goes under ‘// Build a list’ the other code goes under ‘//select the 4th item from the list’ and so on… you get the picture… for me that was keeping me back from running the code…

// Build a list
comicStrip = [‘Codey sees the trail’, ‘Codey starts the hike’, ‘Codey is halfway’, ‘Codey reaches the finish’]

// select the 4th item from the list
comicStrip[3]
// and save it to the variable selection
selection = comicStrip[3]

It should look like this…

// select the 4th item from the list
// and save it to the variable `selection`

selection = comicStrip[3]
3 Likes

I was having the same issue as a number of other people here. I realize the problem I was having is that I was trying to be too smart and was deleting the comments. If you leave the comments that are there and type your code after the relevant comments, you won’t have any issues. (Though it would be ideal if that didn’t cause an error.)

I’m having the same issue!

I’m completely lost, I’ve typed this so far, but all i’m getting is the title Cody Goes on a Hike at the top of the RH screen? Should I be seeing an animation? I’ve coded the same as the above, but no clue how to complete it?

Hello, @blog3326413276! Sorry, you’re getting frustrated. I just looked at the instructions for this lesson, and they are a bit confusing. If your code looks like the code in the post that you replied to, you have extra lines that don’t belong. The examples shown in the lesson text near the beginning are just examples. They’re not to be used in your code. You just need to follow the instructions, and click “Run” when indicated after each step. If you aren’t seeing the expected results in the browser window on the right of the screen, you may have an issue with the browser you are using to access Codecademy. Codecademy works best on Chrome and Firefox. From my experience it doesn’t work well at all with Edge.

I suggest you reset the lesson, and try again entering only the code asked for in the instructions. I’ve included what your code should look like below if you get stuck.

SPOILER:

// Build a list
comicStrip = ['Codey sees the trail', 'Codey starts the hike', 'Codey is halfway', 'Codey reaches the finish']

// select the 4th item from the list
// and save it to the variable selection
selection = comicStrip[3]

Good luck & happy coding!

3 Likes

Many thanks that’s really helpful.

Gill Dawson

1 Like

What does it mean when it says " First, create a list called comicStrip"? I literally just wrote comicStrip = (listed items, etc.). but how does it know that I am making a list by just typing “comicStrip”? shouldn’t i type something like myList=comicStrip?

1 Like

Python automatically determines the data type. so using [] will be recognized as a list by python.

then there are languages like java where you have to indicate the type:

int numberOfDays = 7; 

int declares the data type.

1 Like

Capitilization is KEY in this excercise :stuck_out_tongue:

comicStrip = ['Codey sees the trail', 'Codey starts the hike', 'Codey is halfway', 'Codey reaches the finish']
// select the 4th item from the list
// and save it to the variable selection
selection = [4]

this is my line of code . One thing that I don’t understand is… It is asking to select the 4th item from the list… the list length is equal to 4 but if we have the index of this list as [0,1,2,3] and 3 is the 4th variable why this code give me the message “NOT CORRECT SELECTION” … reading all the comments about this lesson I tried everything i could but I am not sure if I am getting the right result…

so the 4th item is at index 3, when i count elements in a list i usually start at one. The 4th index would have been problematic indeed.

here:

selection = [4]

you just make a new list with the value 4, i don’t see comicStrip anywhere, how is the python interpeter to know you want the an element of an existing list without mentioning this?

1 Like

It makes sense @stetim94. I apologized that I didn’t past the URL for this exercise… I’ve already moved on with the course but I’ll try to get back to it and share the link of comicStrip…

no problem.

Always better to solve the issue on your own :slight_smile:

1 Like

I know… I am getting there eventually!:+1:

Thanks so much!
this helped a lot.

1 Like

You should thank @stetim94… without his feedback, it would take a while to figure this out! :slightly_smiling_face:

guys make sure you read the comments carefully and use exact variable name.
variable names are case sensitive.

// Build a list
list=[‘trail’,‘hike’,‘halfway’,‘finish’]

// select the 4th item from the list
// and save it to the variable selection
list[3]
selection = list[3]

this code will work ten billion percent…:star_struck::star_struck:

1 Like

this line:

list[3]

doesn’t seem to do anything.