Question
*** In Python 23.2 Pig Latin Translator (Branching and Looping) Pig Latin is a language game, unrelated to Latin, in which English words are altered,
23.2 Pig Latin Translator (Branching and Looping)
Pig Latin is a language game, unrelated to Latin, "in which English words are altered, usually by adding a fabricated suffix or by moving the onset or initial consonant or consonant cluster of a word to the end of the word and adding a vocalic syllable to create such a suffix." For example, the translation of "Pig Latin" is "igpay atinlay".
For this assignment you will create a Pig Latin translator. There are several dialects, but we will use the following simplified rules:
- For words that begin with a consonant, move the consonant to the end of the word and add "ay". e.g. pig > igpay
- For words that begin with vowels (including 'y'), the vowel is left alone, and 'way' is added to the end of the word. e.g. eat > eatway
Write a program that gets a word from the user, translates to pig latin as described above, and prints the result.
You may assume that all input is lowercase letters, a-z.
You will need to use a combination of branching, looping, and indexing to accomplish this. Python's membership operator in will prove a useful way to construct necessary tests.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started