Created
March 22, 2013 19:59
-
-
Save anonymous/5224294 to your computer and use it in GitHub Desktop.
Pig Latin Translator (Learned through Codecademy.com's Python Track). There must be a shorter way to determine a vowel within a word.
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
# Defining main variables for translator | |
pyg = 'ay' | |
original = raw_input('Enter a word:') | |
word = original.lower() | |
first = word [0] | |
#Beginning of if/else statements | |
if len(original) > 0 and original.isalpha(): | |
if first == "a" or first == "e" or first == "i" or first == "o" or first == "u": | |
new_word = word+pyg | |
print new_word | |
else: | |
new_word = word[1:]+first+pyg | |
print new_word | |
else: | |
print 'empty' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment