Initialize

Published by Helen Yu in

Create a function that takes in an array of full names and returns the initials.

Examples

initialize_names(["Stephen Hawking"]) ➞ ["S. H."]

initialize_names(["Harry Potter", "Ron Weasley"]) ➞ ["H. P.", "R. W."]

initialize_names(["Sherlock Holmes", "John Watson", "Irene Adler"]) ➞ ["S. H.", "J. W.", "I. A."]

Notes

  • Each initial is followed by a dot.
  • Names will always be made of two words, separated by a space.
Watch a quick demo on how Edabit works.