Decided to make a translator that takes Pig Latin and translates it to English


#1

Here's the code I used. Would love any suggestions for improving it or making it more elegant.

original_pyg = raw_input('Enter a word in Pig Latin:')
less_suffix = original_pyg.lower()[0:(len(original_pyg)-3)]
new_word_pyg = original_pyg[len(original_pyg)-3].upper() + less_suffix

if original_pyg.isalpha():
if original_pyg[len(original_pyg)-2:len(original_pyg)] == 'ay':
print 'English translation: ' + new_word_pyg
else:
print 'Oops! Are you sure you entered a word in Pig Latin? It doesn\'t seem to end with \'ay\'...'
else:
print 'Oops! Looks like your string contains spaces or non-alphabetical characters. Please try again.'


#2

Let's try this!

def igpay_otay_nglisheay(ordway):
    return ordway[-3] + ordway[:-3]

Also we need this

def pig_latin(word):
    return word[1:] + word[0] + 'ay'

So then we do,

a_word = pig_latin('Goffy')
print(a_word)
# OUTPUT: offygay
print(igpay_otay_nglisheay(a_word))
# OUTPUT: goofy

Seems to work for me, you can of course add checks and such but this is the base needs for this code to work.

EDIT:

For flavor you could override the base def/return and any other key word into piglatin for the FLAVOR!