Positive indexes count from the start of the list, negative indexes count from the end of the list.
That is:
bob[0].split()[0] == 'bob'
bob[0].split()[1] == 'smith'
bob[0].split()[-1] == 'smith'
bob[0].split()[-2] == 'bob'
Now say you have someone with a middle name:
jane =['jane elizabeth smith', 42, 30000, 'software']
jane[0].split()[1]
would give Jane's middle name 'elizabeth'
, while jane[0].split()[-1]
would give her last name 'smith'
Now having said all this;
- do not assume a name is made up of two components
- do not assume a name is of the form <first name> <last name>
- do not assume a first name is one word
- do not assume a last name is one word
- do not assume anything!!!
For a more exhaustive list of things you might be wrong about see Falsehoods Programmers Believe About Names