Workout #6 Pig Latin Sentence

Abish Pius
Python Workout
Published in
Sep 19, 2021

Write a function called pl_sentence that takes a string containing several words, separated by spaces.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/1k3kgLI4NUmz0trEWLLAikzxA5qd68dCL?usp=sharing

--

--

Abish Pius
Python Workout

Data Science Professional, Python Enthusiast, turned LLM Engineer