I was able to figure this out with learning some regex.
It works except for the last assertion and I can't figure it out.
VOWELS = "aeiouy"
import re
def translate(phrase):
test = re.sub(r'([bcdfghjklmnpqrstvwxz])([aeiouy])', r'\1', phrase)
new_phrase = re.sub(r'(aa|ii|oo|ee|uu|yy)', '', test)
return new_phrase
assert translate("sooooso aaaaaaaaa") == "sos aaa", "Mayday, mayday"
This last test: I return 'sos a'. I can't figure how to do this and remove the other ooo's etc.
Thanks for any help!!!
Created at: 2019/08/29 01:11; Updated at: 2019/08/30 12:32
The question is resolved.