Skip to content

Latest commit

 

History

History
42 lines (22 loc) · 599 Bytes

Abbreviate_a_Two_Word_Name.md

File metadata and controls

42 lines (22 loc) · 599 Bytes

CodeWars Python Solutions


Abbreviate a Two Word Name

Write a function to convert a name into initials. This kata strictly takes two words with one space in between them.

The output should be two capital letters with a dot separating them.

It should look like this:

Sam Harris => S.H

Patrick Feeney => P.F


Given Code

def abbrevName(name):
    pass

Solution

def abbrevName(name):
    return ".".join([w[0].upper() for w in name.split()])

See on CodeWars.com