<gh_stars>1-10
"""

Lambda functions


Cnvertir esta función en lambda
"""

people = ['Dr. <NAME>', 'Dr. <NAME>', 'Dr. VG <NAME>', 'Dr. <NAME>']

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

# option 1
for person in people:
    print(split_title_and_name(person) == (lambda x: x.split()[0] + ' ' + x.split()[-1])(person))

#option 2
list(map(split_title_and_name, people)) == list(map(lambda person: person.split()[0] + ' ' + person.split()[-1], people))
"""

Lambda functions


Cnvertir esta función en lambda
"""

people = ['Dr. <NAME>', 'Dr. <NAME>', 'Dr. VG <NAME>', 'Dr. <NAME>']

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

# option 1
for person in people:
    print(split_title_and_name(person) == (lambda x: x.split()[0] + ' ' + x.split()[-1])(person))

#option 2
list(map(split_title_and_name, people)) == list(map(lambda person: person.split()[0] + ' ' + person.split()[-1], people))
Lambda functions   Cnvertir esta función en lambda # option 1 #option 2