Please help with the following programming, using python 3 :
Pig Latin is a game of alterations played on words. To translate an English word into Pig Latin, the initial consonant sound is transposed to the end of the word and an “ay” is affixed. Specifically, there are two rules:
- If a word begins with a vowel, append “yay” to the end of the word.
- If a word begins with a consonant, remove all the consonants from the beginning up to the first vowel and append them to the end of the word. Finally, append “ay” to the end of the word.
- dog => ogday
- scratch => atchscray
- is => isyay
- apple => appleyay
Design a function that takes one argument, a string, and returns a string with each word in the argument translated into Pig Latin.
- The split method, when called with no additional arguments, breaks a string into words, and returns the words in a list.
- Slicing is your friend: it can pick off the first character for checking, and you can slice off pieces of a string and use string concatenation (the + operator) to make a new word.
- Making a string of vowels allows use of the in operator: vowels=”aeiou” (how do you make this work with both upper and lower case?)
- Test your function with a diverse range of examples. Your tests should cover all cases (for example, test words beginning with a vowel and words beginning with a consonant). Pay particular attention to edge cases (for example, what happens if the word consists of just one vowel, like “a”? what happens if the string is empty?).