Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
iter solution in Clear category for Bird Language by cimarronm
import re
import string
VOWELS = "aeiouy"
CONSONANTS = "".join(l for l in string.ascii_lowercase if l not in VOWELS)
def translate(phrase):
phraseletter = iter(phrase)
phrase = ""
for letter in phraseletter:
phrase += letter
if letter in VOWELS:
next(phraseletter)
next(phraseletter)
elif letter in CONSONANTS:
next(phraseletter)
return phrase
if __name__ == '__main__':
#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"
April 19, 2015