Write a function is_consonant that takes a character and returns True if it is a consonant. Use your function to create a new function to_piglatin that takes a word, moves all starting consonants (all consonants before the first vowel) to the end of the word, then adds ay to the end and returns the result. You may expect that the input to the function will be just one word. (we know this isn't true pig latin - please do not change this basic algorithm). For a single word input the first letter is capitalized and the rest are lower case as shown in the example below. Examples: (format is: function call -> returns) - do not return this whole string just return the word after the arrow. to_piglatin('stay') -> Aystay to_piglatin('Jared') -> Aredjay to_piglatin('and') -> Anday to_piglatin('CAR') -> Arcay
please code in python
Write a function is_consonant that takes a character and returns True if it is a consonant.
Use your function to create a new function to_piglatin that takes a word, moves all starting consonants (all consonants before the first vowel) to the end of the word, then adds ay to the end and returns the result. You may expect that the input to the function will be just one word. (we know this isn't true pig latin - please do not change this basic
Examples:
(format is: function call -> returns) - do not return this whole string just return the word after the arrow. to_piglatin('stay') -> Aystay
to_piglatin('Jared') -> Aredjay
to_piglatin('and') -> Anday
to_piglatin('CAR') -> Arcay
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images