What does the index number do here?

What does the index [0] do in the code below? What does it refer to? And, before you tell me to play around with the number and see what I can learn, I already did, and it raises an error that my index is out of range. And, again, before you tell me that that is enough for me to learn something, understand that my question is about WHAT is being indexed, which I cannot intuit from this error message alone.

The last few lessons, from the command line on, have been very poorly explained. Your explanations, code choices, etc. need to be clarified.

Screen Link: Learn data science with Python and R projects

The Code:

first_paragraph = parser.find_all("p", id="first")[0]

I just came across a great reason for why you need to be more explicit! On this page: Learn data science with Python and R projects we do not have to modify the index number when accessing the second paragraph, however, on this page: Learn data science with Python and R projects, we DO change the index number when accessing the second inner paragraph.

I’m more confused now than I was before. Please give this a second eye.

Hi @Willyjgolden,

You can find useful this thread.

It seems that in the first case the object contained only one element (with the index [0]), in the second - two or more elements.

the output for the method **.find_all** produces a list. As such if you want to reference a particular member in the list you use list indexing.