Needs to be in python Thanks Prompt the user with the follow

Needs to be in python.

Thanks

Prompt the user with the following question: \"Hi. Please select an option: Convert word to Pig Latin Convert word from Pig Latin If the user selects 1, then prompt the user for the word to be converted. Convert the word Print to the screen: \"Original word: \" original word \"Word in Pig Latin: \" new word If the user selects 2, then prompt the user for the word to be converted. Make sure that the last 2 characters of the word are \"ay\". Otherwise, ask for a new word until they do. Convert the word Print to the screen \"Original word in Pig Latin: \" original word \"Word in English: \" new word If the user enters something other than 1 or 2, exit the program.

Solution

# Pig Latin Converter Code

vowels = \'aeiou\'

print \'1: Convert word to Pig Latin\ \'
print \'2: Convert word from Pig Latin\'
option = raw_input(\'Hi, Please select an option: \')


if option == 1:
original = input(\'Enter the word to be converted to Pig Latin: \')
if len(original) > 0 and original.isalpha():
word = original.lower()
first_letter = word[0]
if first_letter in vowels:
new_word = word + \'ay\'
else:
new_word = \'\'.join(remaining_letters) + first_letter + \'ay\'
print (\'Original Word%s \ \' % (original_word))
print (\'Word in Pig Latin%s \ \' % (original_word))

elif option == 2:
original = input(\'Enter the word to be converted from Pig Latin: \')
if len(original) > 0 and original.isalpha():
word = original.lower()
if word.endswith(\'ay\'):
new_word = word[:-3]
else:
first_letter, last_letter, a, y = word
new_word = last_letter + \'\'.join(remaining_letters)
print (\'Original Word in Pig Latin%s \ \' % (original_word))
print (\'Word in English%s \ \' % (original_word))

else:
exit(0)

Needs to be in python. Thanks Prompt the user with the following question: \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site