Drill

ProblemsPython › warmup

Initials for an avatar

easywarmupPython

The user menu shows initials when someone has no profile picture.

initials(full_name: string) → string

Solve it in the editor →

Where you start

def initials(full_name: str) -> str:
    

Worked examples

CallResult
initials("ada lovelace")"A.L."
initials("Grace Brewster Hopper")"G.B.H."
initials(" linus ")"L."
initials("")""

Hint

Split on whitespace, drop the empty pieces, then take index 0 of each.

Reference solution in Python
def initials(full_name: str) -> str:
    return ''.join(w[0].upper() + '.' for w in full_name.split())

The same problem in another language

More warmup problems in Python