Why it’s the same outcome

I have tried to use Jupyter note book to find out how is this example work.

given x.split('@)
it doses return what you said
but given x.split('@')[1]
it returns:

why it’s the same outcome as the
x.split('@')[-1] ?

the split results in a list with two elements, so the second element (index 1) is the same as the last element (using -1 when accessing by index)

Yes, the zero index. I forgot that basic python concept.

1 Like