Created
October 26, 2021 05:08
-
-
Save weskerfoot/cc385d4c5159b052eeebef5931edcbdb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import zip_longest | |
def convert(st): | |
pairs = zip_longest(st, st[1:]) | |
for c, n in pairs: | |
if c == "e" and n != "e": | |
yield "va" | |
elif c == "e" and n == "e": | |
yield c | |
yield c | |
next(pairs) | |
else: | |
yield c | |
print("".join(convert("hello ee blah this is a test weekly wee"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment