Question: def first _ vowel ( s ) : Returns the position of the first vowel in s; it returns - 1 if
def firstvowels:
Returns the position of the first vowel in s; it returns if there are no vowels.
We define the vowels to be the letters aeio and u The letter
y counts as a vowel only if it is not the first letter in the string.
Examples:
firstvowelhat returns
firstvowelgrrm returns
firstvowelsky returns
firstvowelyear returns
Parameter s: the string to search
Precondition: s is a nonempty string with only lowercase letters
pass
def pigifys:
Returns a copy of s converted to Pig Latin
Pig Latin is childish encoding of English that adheres to the following rules:
The vowels are aeiou 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 ea and the last y
and three consonants the first yr and l
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 'askhay' and 'use' becomes
'usehay'.
If the English word starts with q then it must be followed by'u'; move
qu to the end of the word, and append ay Hence 'quiet' becomes
'ietquay' and 'quay' becomes 'ayquay'.
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'.
Parameter s: the string to change to Pig Latin
Precondition: s is a nonempty string with only lowercase letters. If s starts with
q then it starts with qu
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
