Problem 178624 · easy · Phase 01 Prerequisites & Setup

Initials

strings · split · join · string methods

Write a function initials(name) that takes a person's full name and returns their initials: the first letter of each word, in upper case, each followed by a full stop.

The name may have extra spaces at the start, at the end, or between words. Ignore them.

Examples

Input:  name = "Ada Lovelace"
Output: "A.L."
Input:  name = "grace brewster hopper"
Output: "G.B.H."
Explanation: Lower-case first letters are converted to upper case.
Input:  name = "  alan   turing "
Output: "A.T."
Explanation: Extra spaces are ignored.

Constraints

  • name contains 1 to 5 words made of letters, separated by one or more spaces.

Goals

  • Break a sentence into words with .split()
  • Pick out the first character of a string with indexing
  • Assemble pieces of text with .join() or string concatenation
Starting Python…