1 2 3 4 5 6 7 8 9 10 11 12
#!/usr/bin/env python # -*- coding: utf-8 -*- def replace_e(what: str): count = what.count("e") modified_what = what.replace("e", "E") return count, modified_what # Simple test to verify the functionality assert replace_e("Perl Weekly Challenge") == (5, "PErl WEEkly ChallEngE")