list index out of range when using map()
<p>I tried to use the map function with 1 pre-desined function and 1 parameter. Everything works fine till I call list() on map function. In the end it shows </p>

<blockquote>
  <p>IndexError: list index out of range</p>
</blockquote>

<p>But when I simply call the function on the list without using map(), it was okay. Can anyone try and help me identify the bug?</p>

<hr>

<pre><code>people = ['Dr. Christopher Brooks', 'Dr. Kevyn Collins-Thompson', 'Dr. VG Vinod Vydiswaran', 'Dr. Daniel Romero']

def split_title_and_name(person):

    name_list=[]

    for i in person:
        i = i.split()[0]+" "+i.split()[-1]
        name_list.append(i)

    return name_list 

split_title_and_name(people)
list(map(split_title_and_name, people))
</code></pre>