Accessing list Elements in Codecademy in Introduction to Lists

The first exercise asking you to " Use square brackets ( [ and ] ) to select the 4th employee from the list employees . Save it to the variable employee_four ." The fourth person in the list is Ryan…NOT PAM. If a list is zero-indexed how can Pam be the fourth person in the list. This is a glitch, and it is not the first time.

Hello and welcome to the forums! :wave:

Would you mind sharing a link to that exercise/project page please? :slight_smile:

Sure, thanks. Python Lists | Codecademy

1 Like

So, while “Pam” is not the employee at index 4 as you pointed out, she is the fourth employee in the list as there’s three others before her.

By the sounds of it, it wants you to select the fourth employee (at index 3), which is “Pam”, not the employee stored at index 4 (who as you correctly said would be “Ryan”).

Hopefully that helps! :smile:

That makes sense, but also confusing because if you click on “hint” it reminds you to remember that lists are zero-indexed and that the person that is listed number 3 is actually number 2. That confused me further when I couldn’t figure out why it would not except my answer. You get what I am saying?

1 Like

Yeah I can definitely see what you mean, I think what the hint was trying to say is “even though you’re trying to select the 4th employee, because lists are zero-indexed you actually want to use an index of 3”.

Happy coding! :slight_smile:

Got it. Thanks notlyall

1 Like

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