Skip to content

Instantly share code, notes, and snippets.

@gnilchee
Created February 22, 2015 09:00
Show Gist options
  • Save gnilchee/228faa2e60e63448921a to your computer and use it in GitHub Desktop.
Save gnilchee/228faa2e60e63448921a to your computer and use it in GitHub Desktop.
An Different Pig Latin Translator Example
#!/usr/bin/env python2
import time
def pig_latin():
original = raw_input("Give me a word: ")
if len(original) > 0 and original.isalpha():
# print "You originally inputed:", original
low_orig = original.lower()
pig = "ay"
fl = low_orig[0]
pig_word = low_orig + fl + pig
pig_word = pig_word[1:]
final = pig_word.capitalize()
print "In Pig Latin: ", final
time.sleep(2)
again()
else:
print "That doesn't look right, try again"
pig_latin()
def again():
play = raw_input("Translate another word? (Y)es or (N)o: ").lower()
if play == "yes" or play == "y":
pig_latin()
elif play == "no" or play == "n":
raise SystemExit
else:
print "Input not understood."
again()
pig_latin()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment