Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Python module called piglatin.py that contains functions for translating sentences between English and a variant of Pig Latin (see: http://en.wikipedia.org/wiki/Pig_Latin). To convert from

Write a Python module called piglatin.py that contains functions for translating sentences between English and a variant of Pig Latin (see: http://en.wikipedia.org/wiki/Pig_Latin).

To convert from English to Pig Latin, each word must be transformed as follows:

if the word begins with a vowel, way should be appended (example: apple becomes appleway)

if the word begins with a sequence of consonants, this sequence should be moved to the end, prefixed with a and followed by ay (example: please becomes easeaplay)

NB: Assume, when reverting Pig Latin to English that the original English text does not contain the letter "w".

The Python module will contain the following functions:

to_pig_latin(sentence)

Return the Pig Latin sentence for a given English sentence.

to_english(sentence)

Return the English sentence for a given Pig Latin sentence.

Sample I/O:

(E)nglish or (P)ig Latin?

E

Enter an English sentence:

the quick black fox jumps over the lazy apple

Pig-Latin:

eathay uickaqay ackablay oxafay umpsajay overway eathay azyalay

appleway

Sample I/O:

(E)nglish or (P)ig Latin?

P

Enter a Pig Latin sentence:

eathay uickaqay ackablay oxafay umpsajay overway eathay azyalay

appleway

English:

the quick black fox jumps over the lazy apple

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions

Question

5 TT 7 TT sin 4 6TI 5 TT sin + 4 6 * Find the exact value.

Answered: 1 week ago