12-07-2013, 07:27 PM
I just started learning python yesterday. Master Codecademy made me make this today:
Code:
pyg = 'ay' #Suffix
print "Welcome to the English to PygLatin translator!"
original = raw_input("What would you like to translate? ") #Input
if len(original) > 0 and original.isalpha(): #Check if the word is alphanumeric and is more than one character
word = original.lower() #Set word to lowercase
first = word[0] #Find first letter
if first == 'a' or first == 'e' or first == 'i' or first == 'o' or first == 'u': #Check if first letter is a vowel
new_word = word+pyg #Create new word for vowels
print new_word
else:
new_word = word[1:]+first+pyg #Create new word
print new_word
elif original.isalpha == False:
print "Not alpha-numerical!" #Numbers! Oh no!
else:
print "empty" #No word!