DEV Community

loading...

Discussion on: Daily Challenge #38 - Middle Name

Collapse
hectorpascual profile image
Héctor Pascual

Python :

def middle_name(full_name):
    names = full_name.split(' ')
    return ''.join([name + ' ' if i == 0 or i == len(names)-1 else name[0]+'. ' for i, name in enumerate(names)])
Collapse
teotcd profile image
JedDevs

Nice,
Here's my Python solutions!
dev.to/teotcd/comment/e6fl