mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
18 lines
484 B
Python
18 lines
484 B
Python
def translate(word):
|
|
vowels = "aeiou"
|
|
if word[0] in vowels:
|
|
return word + "way"
|
|
else:
|
|
consonants = ""
|
|
for letter in word:
|
|
if letter not in vowels:
|
|
consonants += letter
|
|
else:
|
|
break
|
|
return word[len(consonants) :] + consonants + "ay"
|
|
|
|
|
|
def pig_latin(text):
|
|
words = text.lower().split()
|
|
translated_words = [translate(word) for word in words]
|
|
return " ".join(translated_words)
|