Created
January 31, 2018 16:19
-
-
Save leleofg/3f62b4d52a22cb507b67f8a9f32e346a to your computer and use it in GitHub Desktop.
Example Map function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)) | |
| #['Dr. Brooks', 'Dr. Collins-Thompson', 'Dr. Vydiswaran', 'Dr. Romero'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment