Problem

Pig LatinPig Latin is a game of alterations played on words. To make the Pig Latin form of...

Pig Latin

Pig Latin is a game of alterations played on words. To make the Pig Latin form of an English word the initial consonant sound is transposed to the end of the word and an “ay” is affixed. Specifically there are two rules:

(a) If a word begins with a vowel, append “yay” to the end of the word.

(b) If a word begins with a consonant, remove all the consonants from the beginning up to the first vowel and append them to the end of the word. Finally, append “ay” to the end of the word.

For example:

• dog ⇒ ogday

• scratch ⇒ atchscray

• is ⇒ isyay

• Apple ⇒ appleyay

Write a program that repeatedly prompts for an English word to translate into Pig Latin and prints the translated word. If the user enters a period, halt the program.

Hints:

• Slicing is your friend: it can pick off the first character for checking, and you can slice off pieces and concatenate to yield the new word.

• Making a string of vowels allows use of the in operator: vowels = 'aeiou'.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 4
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT