Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Bird Language by karolk10
VOWELS = "aeiouy"
def translation(phrase):
trans = ""
k = 0
l = 0
i = 0
while i < len(phrase)-1:
for j in VOWELS:
if phrase[i] == j and i + 2 <= len(phrase) - 1:
if phrase[i+1] == phrase[i] and phrase[i+2] == phrase[i]:
k = 1
if k == 1:
trans = trans + phrase[i]
k = 0
i = i + 2
else:
for j in VOWELS:
if j == phrase[i]:
l = 1
if l == 0:
trans = trans + phrase[i]
l = 0
i = i + 1
print(trans)
return trans
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert translation("hieeelalaooo") == "hello", "Hi!"
assert translation("hoooowe yyyooouuu duoooiiine") == "how you doin", "Joey?"
assert translation("aaa bo cy da eee fe") == "a b c d e f", "Alphabet"
assert translation("sooooso aaaaaaaaa") == "sos aaa", "Mayday, mayday"
Nov. 20, 2016