Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is a python program: You are to write a python program that can input English text from a user from the keyboard and translate

this is a python program:

You are to write a python program that can input English text from a user from the keyboard and translate it into Pig Latin and display it. Pig Latin is an invented language formed by transforming each word according to the following rules:

1. If the word starts with a vowel ('a', 'e', 'i', 'o', 'u', or 'A, 'E', 'I', 'O', 'U') or does not contain a vowel, its Pig Latin equivalent is formed by just adding the suffix way. 2. If the word starts with a consonant (any letter that is not a vowel) and contains a vowel its Pig Latin equivalent is formed by moving the initial consonant string (that is all letters up to the first vowel) from the beginning of the word to the end and then adding the suffix ay. 3. If a word is transformed by rule 2) and starts with an upper case character (consonant), its Pig Latin equivalent also starts with an upper case character (vowel) and the consonant is changed to lower case. A word will be taken to mean any consecutive sequence of letters, i.e. you don't have to check that the sequence is actually an English word. A word is terminated by any non-letter (e.g white space, punctuation mark, etc.). Example translations are "is" would be translated as "isway", by would be translated as byway, girl would be translated as irlgay, "Blue" would be translated as "Ueblay".

You can use islpha() function to check if a character is a alphabetic letter or not. The function will return false if the character is not an alphabetic letter (examples: white space or a punctuation).

You are required to implement at least the 4 following user-defined functions in this program. - A function accepting one English word and returns True if it doesnt contain a vowel otherwise False. - A function accepting one English word and returns its Pig Latin word using rule 1 mentioned above. - A function accepting one English word and returns its Pig Latin word using rule 2 and 3 mentioned above. - A function accepting one English sentence and returns its Pig Latin equivalent. * Inside this function you need to use the above two functions. Here, you will need to find where the non-alphabetic letters (white space and punctuation) are located. Then use that information to extract the English words.

TWO Sample I/O (bolded are user input) Enter English sentence: The black cat ate the mouse by a pond. Ethay ackblay atcay ateway ethay ousemay byway away ondpay.

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

Deductive And Object Oriented Databases Second International Conference Dood 91 Munich Germany December 18 1991 Proceedings Lncs 566

Authors: Claude Delobel ,Michael Kifer ,Yoshifumi Masunaga

1st Edition

3540550151, 978-3540550150

More Books

Students also viewed these Databases questions