Question: PART B: PROGRAMMING WITH STRINGS Develop a Python program which will convert English words into their Pig Latin form, as described below. You will work

PART B: PROGRAMMING WITH STRINGS
Develop a Python program which will convert English words into their Pig Latin form, as described below.
You will work with partners on this exercise during your lab session. On-line students: you can do
it on your own or with a partner. Best place to find a partner is Piazza.
The program will repeatedly prompt the user to enter a word. First convert the word to lower case. The word
will be converted to Pig Latin using the following rules:
a) If the word begins with a vowel, append way to the end of the word.
b) If the word begins with a consonant, remove all consonants from the beginning of the word and
append them to the end of the word. Then, append ay to the end of the word.
For example:
"dog" becomes "ogday"
"scratch" becomes "atchscray"
"is" becomes "isway"
"apple" becomes "appleway"
"Hello" becomes "ellohay"
"a" becomes "away"
The program will halt when the user enters quit(any combination of lower and upper case letters, such as
QUIT,Quit or qUIt).
Suggestions:
a) Use .lower() to change the word to lower case.
b) How do you find the position of the first vowel? I like using enumerate(word) as in
for i,ch in enumerate(word)
where ch is each character in the word and i is the characters index (position).
c) Use slicing to isolate the first letter of each word.
d) Use slicing and concatenation to form the equivalent Pig Latin words.
e) Use the in operator and the string "aeiou" to test for vowels.
Good practice: define a constant VOWELS = "aeiou"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!