basestr ="HhEEeLLlOOFROlMTHEOTHERSIDEooEEEEEE" def replacer (basestr, toBeRemove, newchar) : for i in toBeRemove : if i in basestr : basestr = basestr.replace(i, newchar) return basestr newstring = replacer(basestr,['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'], "") print(basestr) print(newstring)
Output:
HhEEeLLlOOFROlMTHEOTHERSIDEooEEEEEE
Helloo
source share