Write a function that translates english language text to


In python, Write a function that translates English language text to "Pig Latin" according to the following rules for translating one word: If the word begins with a vowel (a,e,i,o,u), then it is simply translated by appending 'way' to the end of it.

As examples, 'act' becomes 'actway' and 'old' becomes 'oldway' and so on. If the word does not begin with a vowel (it starts with a consonant), then it is translated by moving all consonant letters up to the first vowel to the end of the word with 'ay' appended to the very end.

As examples, 'gasp' becomes 'aspgay' and 'school' becomes 'oolschay' and so on. This rule also applies when the word has no vowels at all - in that case, 'ay' is simply appended. Special cases: The letter 'y' is counted as a vowel in this context (when a word begins with a consonant).

Examples: 'system' becomes 'ystemsay' and 'crystal' becomes 'ystalcray' and so on. The letter 'u' is counted as a consonant when it follows the letter 'q' in a word, so 'queen' becomes 'eenquay' and 'square' becomes 'aresquay' for examples. Capitalization is properly maintained.

Words that are all capital letters are translated to all capital letters ('IBM' becomes 'IBMWAY' and 'CRUMB' becomes 'UMBCRAY'). Also, words that are properly capitalized are translated with proper capitalization ('Apple' becomes 'Appleway' and 'Mark' becomes 'Arkmay') We suggest you solve this problem in two parts, and the points will be allocated accordingly:

Get the function working for just one word. That is, full credit for this part is earned by translating text that consists of nothing except alphabetic characters.

Return (don't print) the translated text as a string. See (and be sure to match) the first few sample runs below.

Improve the function so that it works with text that consists of any characters, and presumably multiple words. Translate each word separately.

A word is defined as any consecutive sequence of alphabetic letters, and they may be separated by any sequence of non-letter characters.

All non-letter characters should just be copied to the Pig Latin translation.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a function that translates english language text to
Reference No:- TGS02908384

Expected delivery within 24 Hours