There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
You can also find further discussion and get answers to your questions over in Language Help.
Agree with a comment or answer? Like () to up-vote the contribution!
I think there is an error in this exercise. The question asks you to use square brackets ( [ and ] ) to select the 4th employee from the list employees .
Because Pythons uses zero index, the fourth employee should be Ryan. When you write: print(employees[4]) , Ryan is the output. However, the model won’t let you progress unless you assign Pams name to the variable employee_four.
We can see that ‘Pam’ is the fourth name in the list. Index 4 would give us ‘Ryan’, but that is the fifth name. The instructions are clear in that they want the fourth name. That is at index 3.
Oh I see. I have been counting lists with the first element as ZERO in line with the way that list elements are indexed in Python, which I think is why I was confused. I didn’t realise that the questions are framed in a way that ask you to count the first element as the first (and then match it with the correct index, starting from 0) - confusing! This became more clear to me as I progressed through the working with lists modules and realised I was getting answers wrong because I was counting from 0 instead of first, second, third etc to find the right element. It’s starting to make more sense as I get used to it
Because our lists are zero indexed, our fourth element is saved as:
employee_four = employees[3]
As such, because we want to display the fourth element our final result is:
print(employees[3])
Correction: I have the right answer now. I am still, somewhat, confused in terms of how I can get some answers wrong (even with the correct code) but at other times I am right.
is not the correct code. We are asked to print the variable.
Careful not to be deceived by confirmation bias. Easier to accept there is a possible error and find it than to be convinced there is no error and have it staring you in the face. Programmers must first learn responsibility so they can admit to and accept their mistakes.
It’s a fledgling mistake. Don’t beat yourself up. There is a whole universe opening up to you. Mistakes is how it becomes most evident. Pride yourself, and surge forward.