Question

Please use PYTHON3 to Create a program that translates English into Pig Latin. The function will...

Please use PYTHON3 to Create a program that translates English into Pig Latin. The function will take the first letter of each word in the sentence only if it’s a not a vowel, and place it at the end of the word followed by “ay”. Your program must be case insensitive. You must write the function translate() that takes in a single English word and returns its Pig Latin translation. Remember translate must take only one word as input.

#############################################################

# translate() takes a single english word translates it to pig latin

# Input: english_word; an English word

# Output: the pig latin translation

PLEASE DON'T USE FOR LOOP OR BREAK.

PLEASE USE MEANIGFULl VARIABLES

0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE

def translate(original):

new_word = ""

if len(original) > 0 and original.isalpha():

word = original.lower()

first = word[0]

if first == ('a' or 'e' or 'i' or 'o' or 'u'):

new_word = word + pyg

else:

new_word = word[1:] + first + pyg

return new_word

else:

return None

# PygLatin Converter Code

pyg = 'ay'

original = input('Enter a word: ')

print(translate(original))

Add a comment
Know the answer?
Add Answer to:
Please use PYTHON3 to Create a program that translates English into Pig Latin. The function will...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • use C++ Pig Latin Background Pig latin is a "language” where you take the regular English...

    use C++ Pig Latin Background Pig latin is a "language” where you take the regular English Word, remove the first letter, place it on the end of the word, and then append "ay" to the end of the word. Pig Latin = Igpay Atinlay Functionality 1) Prompt the user to enter any input string (I will test it with multiple words). 2) After receiving and storing (if needed) their input, change their words to Pig Latin by placing the first...

  • In C please Pig latin has two very simple rules: If a word starts with a...

    In C please Pig latin has two very simple rules: If a word starts with a consonant move the first letter(s) of the word, till you reach a vowel, to the end of the word and add "ay" to the end. have ➞ avehay cram ➞ amcray take ➞ aketay cat ➞ atcay shrimp ➞ impshray trebuchet ➞ ebuchettray If a word starts with a vowel add "yay" to the end of the word. ate ➞ ateyay apple ➞ appleyay...

  • In C Sixth: Pig Latin (10 Points) For this part of the assignment, you will need...

    In C Sixth: Pig Latin (10 Points) For this part of the assignment, you will need to write a program that reads an input string representing a sentence, and convert it into pig latin. We'll be using two simple rules of pig latin: 1. If the word begins with a consonant then take all the letters up until the first vowel and put them at the end and then add "ay" at the end. 2. If the word begins with...

  • JAVA PROGRAMMING LANGUAGE!!!! Pig Latin Write a program that reads a sentence as input and converts...

    JAVA PROGRAMMING LANGUAGE!!!! Pig Latin Write a program that reads a sentence as input and converts each word to "Pig Latin". In one version of Pig Latin, you convert a word by removing the first letter, placing that letter at the end of the word, and then appending "ay" to the word. Here is an example: English:                       I SLEPT MOST OF THE NIGHT Pig Latin :                   TAY LEPTSAY OSTMAY FOÀY HETAY 1GHTNAY make sure that there are two...

  • Pig Latin program using Linked Lists C++

    Write a program that prompts the user to input a string and then outputs the string in the pig Latin form. The rules for converting a string into pig Latin form are asfollows:a. If the string begins with a vowel, add the string "-way" at the end of the string. for example, the pig Latin form of the string "eye" is "eye-way".b. If the string does not begin with a vowel, first ass "-" at the end of the string....

  • Pig Latin Translator in Java The goal here is to read in the characters stored in a text file and create a second text file that contains the original text but with every word converted to “Pig-Latin....

    Pig Latin Translator in Java The goal here is to read in the characters stored in a text file and create a second text file that contains the original text but with every word converted to “Pig-Latin.” The rules used by Pig Latin are as follows: • If a word begins with a vowel, just as "yay" to the end. For example, "out" is translated into "outyay". • If it begins with a consonant, then we take all consonants before...

  • Im writing a c++ program to translate a sentence to pig latin. But I keep getting...

    Im writing a c++ program to translate a sentence to pig latin. But I keep getting an error where it only prints out the "ay" part. Not sure where I'm wrong here. string piglatin(string); string substr(string, int&); int main () //begin main { string input; cout<<"Enter a sentence to convert: "; getline(cin, input); cout<<"Converted to Pig Latin: "<<piglatin(input)<<endl<<endl; //cout << "Search for another value? (Y/N)"; //to convert again system("pause"); return 0; } string piglatin(string input) //piglatin function { int len,...

  • Design and code a SWING GUI to translate text entered in English into Pig Latin. You...

    Design and code a SWING GUI to translate text entered in English into Pig Latin. You can assume that the sentence contains no punctuation. The rules for Pig Latin are as follows: For words that begin with consonants, move the leading consonant to the end of the word and add “ay”. Thus, “ball” becomes “allbay”; “button” becomes “uttonbay”; and so forth. For words that begin with vowels, add “way’ to the end of the word. Thus, “all” becomes “allway”; “one”...

  • Pig Latin Translator in Java The goal here is to read in the characters stored in...

    Pig Latin Translator in Java The goal here is to read in the characters stored in a text file and create a second text file that contains the original text but with every word converted to “Pig-Latin.” The rules used by Pig Latin are as follows: • If a word begins with a vowel, just as "yay" to the end. For example, "out" is translated into "outyay". • If it begins with a consonant, then we take all consonants before...

  • Assignment 5 Due Apr 5 by 11:59pm Points 100 Submitting a file upload A5 Wrapper Classes "Pig Lat...

    Assignment 5 Due Apr 5 by 11:59pm Points 100 Submitting a file upload A5 Wrapper Classes "Pig Latin" Access A5 from pdf assigament file t Turn in the following files aSmain java program compile and run screenshots design document AS 15. Pig Latin Write a program that reads a sentence as input and converts each word to "Pig Latin". In one version of Pig Latin, you convert a word by removing the first letter, placing that letter at the end...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT