In this assignment, you will write a Python program that translates English to Pig Latin. Specifically, write a program
Posted: Fri Jun 10, 2022 11:54 am
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 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. 소소
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 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. 소소