Question: def first _ vowel ( s ) : Returns the position of the first vowel in s; it returns - 1 if

def first_vowel(s):
"""
Returns the position of the first vowel in s; it returns -1 if there are no vowels.
We define the vowels to be the letters 'a','e','i','o', and 'u'. The letter
'y' counts as a vowel only if it is not the first letter in the string.
Examples:
first_vowel('hat') returns 1
first_vowel('grrm') returns -1
first_vowel('sky') returns 2
first_vowel('year') returns 1
Parameter s: the string to search
Precondition: s is a nonempty string with only lowercase letters
"""
pass
def pigify(s):
"""
Returns a copy of s 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 'l').
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 'askhay' and 'use' becomes
'usehay'.
3. 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'.
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'.
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 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 Programming Questions!