Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
very basic using exception handling solution in Clear category for Bird Language by lucas.stonedrake
VOWELS = "aeiouy"
def translation(phrase):
lst = [list(entry) for entry in phrase.split()] #split and make a list of lists
for word in lst: # for each nested list (each word)
for x in range(len(word)): # for each letter of the word
try:
if word[x] in VOWELS: del word[x+1:x+3] # if vowel, delete next two letters
else: del word[x+1] # if not a vowel, delete next letter
except: continue #if error, must be at end of word, so continue
#join the lists of letters then join the words with a space
return ' '.join([''.join(word) for word in lst])
if __name__ == '__main__':
print("Example:")
print(translate("hieeelalaooo"))
#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"
print("Coding complete? Click 'Check' to review your tests and earn cool rewards!")
Oct. 19, 2020
Comments: