PygLatin Reference Code


#1

Take a look at the code below if you are having issues. It's not complete but it may help you out.

# Print the introduction 

print 'Welcome to the Pig Latin Translator!'

#A variable that stores the letters ay to add to the end of the translated word

pyg = 'ay'


#Ask the User for a word and store it as variable original

original = raw_input("Enter a word:")

#If/else statement to check the raw_input string original for 
#at least one letter and alphabetic characters only.

if len(original) > 0 and original.isalpha():
    print original
    
else:
    print "empty"
    
#A variable that stores the lower case value of original

word = original.lower()

#FOR DEBUGGING

print word

#A variable that stores the first letter of word

first = word[0]

#FOR DEBUGGING

print first

#A variable that stores the concatentation of word first and
#pyg

new_word = word + first + pyg

#A variable that slices the first letter off of new_word

new_word = new_word[1:len(new_word)]

#FOR DEBUGGING

print new_word

#2

Hey @lowlyf great of you to try and help people out, but we normally prefer people to only post code to help with specific issues. I.e. only show people the relevant part of your code if they are really stuck and not understanding anything at all.

So nice of you to make this, but try to answer specific questions next time instead of making the code so easy for others to cheat from!

Cheers,
Alex