In this assignment, you will write a Python program that translates English to Pig Latin. Specifically, write a program

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
correctanswer
Posts: 43759
Joined: Sat Aug 07, 2021 7:38 am

In this assignment, you will write a Python program that translates English to Pig Latin. Specifically, write a program

Post by correctanswer »

In this assignment, you will write a Python program that
translates English to Pig Latin.
Specifically, write a program that prompts the user for a
sentence, prints the sentence after converting each word to its Pig
Latin version. It then prompts the user whether to continue, and
prompts the user again if user enters 'y', otherwise ends the
program.
Here are the rules of converting the word to Pig Latin:
In This Assignment You Will Write A Python Program That Translates English To Pig Latin Specifically Write A Program 1
In This Assignment You Will Write A Python Program That Translates English To Pig Latin Specifically Write A Program 1 (311.59 KiB) Viewed 186 times
In this assignment, you will write a a program that translates English to Pig Latin. Specifically, write a program that prompts the user for a sentence, prints the sentence after converting each word to its Pig Latin version. It then prompts the user whether to continue, and prompts the user again if user enters 'y', otherwise ends the program. Here's a sample run: IDLE Shell 3.10.4 Eile Edit Shell Debug Options Window Help Welcome to the Piglatin translator Enter the sentence to be translated: yes, let's go Translated sentence: esyay etslay ogay Continue? (y/n) y Enter the sentence to be translated: a sly fox Translated sentence: away yslay oxfay Continue? (y/n) y Enter the sentence to be translated: This 'pig latin' stuff is fun!! Translated sentence: isthay igpay atinlay uffstay isway unfay Continue? (y/n) n Ln: 65 Col: 0 Here are the rules of converting the word to Pig Latin: • English to lowercase before translating. • Remove any punctuation characters before translating such as '?',!,!!, ""," • Assume that words are separated from each other by a single space. (Hint: You can use the split method to create a list of words and use a for loop to process the list) • If the word starts with a vowel, just add 'way' to the end of the word. e.g. 'on' is converted to 'onway' • If the word starts with a consonant, move all of the consonants that appear before the first vowel to the end of the word, then add 'ay' to the end of the word. e.g. 'hot' is converted to 'othay" and 'strong' is converted to 'ongstray' • If a word starts with the letter y, they should be treated as a consonant. e.g. 'yes' is converted to 'esyay' • If the y appears anywhere else in the word, it should be treated as a vowel. e.g. 'sly' is converted to 'yslay' Note: There are no official rules for Pig Latin. Most people agree on how words that begin with consonants are translated, but there are many different ways to handle words that begin with vowels. 소소
Register for solutions, replies, and use board search function. Answer Happy Forum is an archive of questions covering all technical subjects across the Internet.
Post Reply