We're a place where coders share, stay up-to-date and grow their careers.
Python :
import re def fix_virus(document): doc = document.lower().capitalize() return re.sub(r'ie','ei',doc)
Python one-liner :
fix_virus = lambda doc : re.sub(r'ie','ei',doc.lower().capitalize())
If it's a document, it will contains multiple sentences and capitalize is only uppercasing the first letter of a string
Ok then split document by lines and call the function :
document_splitted = document.split('\n') for line in document_splitted: fix_virus(line) ....
Or capitalize each line of the document after lowering :)
Your solution is very good btw. Good job
Python :
Python one-liner :
If it's a document, it will contains multiple sentences and capitalize is only uppercasing the first letter of a string
Ok then split document by lines and call the function :
Or capitalize each line of the document after lowering :)
Your solution is very good btw. Good job