Workout #5: Pig Latin
For this exercise, write a Python function (pig_latin) that takes a string as input, assumed to be an English word. The function should return the translation of this word into Pig Latin. You may assume that the word contains no capital letters or punctuation.
The rules for translating words from English into Pig Latin are quite simple:
- If the word begins with a vowel (a, e, i, o, or u), add “way” to the end of the word. So “air” becomes “airway” and “eat” becomes “eatway.”
- If the word begins with any other letter, then we take the first letter, put it on the end of the word, and then add “ay.” Thus, “python” becomes “ythonpay” and “computer” becomes “omputercay.”
TRY IT YOURSELF
ANSWER
https://colab.research.google.com/drive/1AkITwJbxYcCCEPjV44BT5_E2Hg8helyC?usp=sharing