DEV Community

loading...

Discussion on: Daily Challenge #39 - Virus

Collapse
matrossuch profile image
Mat-R-Such

Python

def proofread(string):
    if string.rstrip()[:-1].count('.') == 0:    return string.lower().replace('ie','ei').capitalize()
    string= '. '.join([i.lower().replace('ie', 'ei').lstrip().capitalize() for i in string.split('.')])
    if string[-1] == ' ':   return string[:-1]
    else:   return string