Saturday, November 10, 2012

7/30 & 8/30: Coding



 I got only 5 minutes of coding done on the 7th day of coding.  Today on the other hand!  This is what I did! ^_^ So awesome!!  It turns any word into pyg-latin.  I threw in lots of filler since I was hearing the voice of Dr. Heinz Doofenshmirtz in my head.  His -Inator's are very inspiring. 

 I wonder if I can actually embed it into the blog so you can use it. Okay I can't figure out how to do it.  But you can paste it into this which is where I've been practicing my python.

^_^ My code! *preens* It's so pretty!! *giddy*

print "BEHOLD! My Pig-Latin-Translator-Inator!!"
print "*voice of Doctor Doofenshmirtz*"
pyg = 'ay'
original = raw_input('Go ahead! Give me a word. I dare you!')
word=original.lower()
first=word[0]
vowel_word=word+pyg
new_word=word[1:]+first+pyg  
if len(original) > 0 and original.isalpha():
    if first=="a" or first=="e" or first=="i" or first=="o" or first=="u" or first=="A" or first=="E" or first=="I" or first=="O" or first=="U":
        print vowel_word
    else:
        print new_word
    print "Oh. I thought it was going to turn everything into pig noises or something like that... I could probably fix it, but this'll work. Well? Impressive isn't it.  With it I shall control the ENTIRE TRI STATE AREA!! HAHAHAHAHAHAHA *chokes on a swallowed fly*"
else:
    print "Well it looks like SOMEONE can't follow directions."

#word[0] means it starts at the 0 position of the word
#word[1:] means it starts in the 1 position and goes to the end

No comments:

Post a Comment