Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Concise algorithm solution in Speedy category for Bird Language by Igor_Sekretarev
VOWELS = 'aeiouy'
def translate(phrase: str) -> str:
translation = ''
i = 0
while i < len(phrase):
translation += phrase[i]
if phrase[i] == ' ':
i += 1
elif phrase[i] in VOWELS:
i += 3
else:
i += 2
return translation
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!")
April 26, 2021
Comments: