You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
882 B

VOWELS = "aeiouy"
def translate(phrase):
sentence = ""
pointer = 0
while pointer < len(phrase):
char = phrase[pointer]
if char not in VOWELS:
sentence += char
pointer += (1 if char == ' ' else 2)
else:
sentence += char
pointer += 3
return sentence
if __name__ == '__main__':
print("Example:")
print(translate("hieeelalaooo"))
# These "asserts" using only for self-checking and not necessary for auto-testing
assert translate("hieeelalaooo") == "hello", "Hi!"
assert translate("hoooowe yyyooouuu duoooiiine") == "how you doin", "Joey?"
assert translate("aaa bo cy da eee fe") == "a b c d e f", "Alphabet"
assert translate("sooooso aaaaaaaaa") == "sos aaa", "Mayday, mayday"
print("Coding complete? Click 'Check' to review your tests and earn cool rewards!")