Skip to content

Instantly share code, notes, and snippets.

@kevgathuku
Created July 31, 2014 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevgathuku/0e7117541e69c3e499da to your computer and use it in GitHub Desktop.
Save kevgathuku/0e7117541e69c3e499da to your computer and use it in GitHub Desktop.
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
pyg = 'ay'
while True:
original = raw_input('Enter a word: \t')
if len(original) > 0 and original.isalpha():
word = original.lower()
first = word[0]
vowels = 'aeiou'
if first in vowels:
new_word = original + pyg
print new_word
break
else: #The word is a consonant
new_word = original[1:] + first + pyg
print new_word
break
else:
print 'You entered invalid input. Please try again'
@kevgathuku
Copy link
Author

PyGlatin Codecademy Project Slightly modified to run again if invalid input is detected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment