Created
June 13, 2018 23:37
-
-
Save accessnash/65a2f0f97d98d26c12e6bfec127b6f88 to your computer and use it in GitHub Desktop.
A function to split names and keep only title and last names
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
| Personalities = ['Mr. Clarke Kent', 'Dr. Victor Doom', 'Dr. Stephen Strange', 'Dr. Jonathan Osterman'] | |
| def split_names(superhero): | |
| title = superhero.split()[0] | |
| lastname = superhero.split()[-1] | |
| return '{} {}'.format(title, lastname) | |
| list(map(split_names, Personalities)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment