Write a program in Python to Convert any sentence to Pig Latin.

Before we proceed to write a python program, we must know what actually is Pig Latin?

What is Pig Latin?

It is said that Pig Latin is not any kind of language but is a language game that children use to speak in code. It is formed by altering the letters in a word.

Here’s how it works: First, pick an English word. We’ll use dictionary. Next, move the first consonant or consonant cluster to the end of the word: “ictionary-d.” Now add “ay” to the end of the word: “ictionary-day.” That’s all there is to it; you’ve formed a word in Pig Latin.

I recommend you to read more about Pig Latin on wiki.

Now we have some idea what exactly is Pig Latin, so let’s try converting a whole sentence into its Pig Latin form.


Pig Latin Program output


  1. Take sentence input.
  2. Split sentence into words using split().
  3. Loop through words and check if the word begins with vowel. If yes then simply concatenate “ay” and update the existing word in the words list.
  4. Else check if there is any vowel present in between of the word. If yes then get the first vowel index position and postfix all the consonants present before that vowel to the end of the word along with “ay”.
  5. Otherwise postfix “ay” to the word because it doesn’t has any vowel.
  6. Form new sentence using join() and output it.

If you have any doubts or suggestions then please comment below.

Leave a Reply

2 × 2 =