This is my final code for the PygLatin translantor. I followed all of the computer directions, and added some tweaks so it works with more words, but I cant get it to work with spaces, so I can do a sentence of PygLatin. I know I would need to erase the isalpha function, but after that I have no idea of what to do so it stops at a space and starts again with the next word in a sentence. Can somebody please help?
def is_consonant(nonvowel): all_consonants = 'bcdfghjklmpqrstvwxyz' return nonvowel in all_consonants def is_vowel(char): all_vowels = 'aeiou' return char in all_vowels vowel = 'way' pyg = 'ay' original = raw_input('Enter one word:') if len(original) > 0 and original.isalpha(): word = original word = word.lower() first = word new_word = word + first + pyg new_word = new_word[1:len(new_word)] combo_word = word[2:] + word[0:2] + pyg vowel_word = word + vowel if (is_consonant(word[0:1])) and (is_consonant(word[1:2])): print combo_word elif (is_vowel(word)): print vowel_word else: print new_word else: print 'invalid word'