Thursday, March 20, 2014

Piglatin

I missed a day, however I started learning Python today. Here’s where I’m at.

"""
Translate to Piglatin in python
by CQ
3/20/2014
"""

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
    word = original.lower()
    first = word[0]
    new_word = word[1:len(word)] + first + pyg
    print new_word
else:
    print 'empty'

 

Lesson learned: Always follow instructions, even though it looks funny at first. Read, understand, then follow the instructions.

No comments:

Post a Comment