Question: (Python) def pigify(w): ''' Returns: copy of w converted to Pig Latin Parameter w: the word to change to Pig Latin Precondition: w is a

(Python) def pigify(w): ''' Returns: copy of w converted to Pig Latin Parameter w: the word to change to Pig Latin Precondition: w is a nonempty string with only lowercase letters''' 

(Python) def pigify(w): ''' Returns: copy of w converted to Pig Latin

Pig Latin is childish encoding of English that adheres to the following rules: 1. The vowels are 'a', 'e', 'i', 'o', 'u', as well as any 'y' that is not the first letter of a word. All other letters are consonants. For example, 'yearly' has three vowels ('e', 'a', and the last 'y') and three consonants (the first 'y', 'r', and 'i'). 2. If the English word begins with a vowel, append 'hay' to the end of the word to get the Pig Latin equivalent. For example, 'ask' becomes 'askhay, 'use' becomes 'usehay'. 3. If the English word starts with 'q', assume it is followed by 'u'; move 'qu' to the end of the word, and append 'ay'. Hence 'quiet' becomes 'ietquay', 'quay' becomes 'ayquay'. 4. If the English word begins with a consonant, move all the consonants up to the first vowel (if any) to the end and add 'ay'. For example, 'tomato' becomes 'omatotay', 'school' becomes 'oolschay', 'you' becomes 'ouyay', and 'ssssh' becomes 'sssshay'. Your goal is to write a function pigify that take a single English word (e.g. a string with only letters and no spaces), and converts it into Pig Latin

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!