Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 587 Bytes

File metadata and controls

20 lines (14 loc) · 587 Bytes
people = ['Dr. Christopher Brooks', 'Dr. Kevyn Collins-Thompson', 'Dr. VG Vinod Vydiswaran', 'Dr. Daniel Romero']

def split_title_and_name(person):
    return person[0]+' '+person[-1]

list(map(split_title_and_name, [person.split(' ') for person in people]))
people = ['Dr. Christopher Brooks', 'Dr. Kevyn Collins-Thompson', 'Dr. VG Vinod Vydiswaran', 'Dr. Daniel Romero']

def split_title_and_name(person):
    title = person.split()[0]
    lastname = person.split()[-1]
    return '{} {}'.format(title, lastname)

list(map(split_title_and_name, people))