DEV Community


Discussion on: Piglatin in python and orgmode.

pbouillon profile image
Pierre Bouillon

Awesome ! I was curious so I tried to implement it too in my free time, here is my a-little-more-concise solution !

def to_pig_latin(word: str) -> str:
    """convert a word to piglatin

    :param word: word to convert
    :return: the pigralitine version of the word

    if word[0] in 'aeiou':
        complementary = 'way'
        complementary = f'{word[0]}ay'

    return f'{word[1:]}{complementary}'

if __name__ == '__main__':
    words = [

    for word in words:
        print(f'{word} is {to_pig_latin(word).title()} in piglatin')
zeeter profile image
D Smith Author

Oh thats good! Mine was meant to be entirely run inside this article using orgmode and such. I totally forgot to set it up so that you can tangle the file out.

Forem Open with the Forem app