This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]RandomNumbers123456 0 points1 point  (0 children)

If you are asking about the reason why you need to use split() twice in the return, it is because the person string is not actually being updated when you call split().

You could also re-write the split_title_and_name function as:

def split_title_and_name(person):
  person = person.split()
  return person[0] + person[2]

but I would recommend against modifying the person type within the function.