Created
January 3, 2014 00:43
-
-
Save wjimenez5271/8230340 to your computer and use it in GitHub Desktop.
pig_latin_translate.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define the suffix we'll use in pig latin | |
| pyg = 'ay' | |
| #ask for input of the word to translate | |
| original = raw_input('Enter a word:') | |
| #santize input and check to see if word starts with a vowel or consonant | |
| if len(original) > 0 and original.isalpha(): | |
| original = original.lower() | |
| print "you entered: " + original | |
| if (original[0] == 'a' or original[0] == 'e' or original[0] == 'i' or original[0] =='u'): | |
| new_word = (original + pyg) | |
| print new_word | |
| else: | |
| word2 = original[1:] | |
| new_word = word2 + original[0] + pyg | |
| print new_word | |
| else: | |
| print 'empty, please supply a word to be translated' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment