Lab 4 : PigLatin

Description:

In this lab, I had to get accustomed to typing down the codes to change a normal English word to its Pig Latin version.

 

 

Code:

This is the sample code.

pyg = 'ay'

original = raw_input('Enter a word:')
if len(original) > 0 and original.isalpha():
    word = original.lower()
    first = word[0]
    if first == "a" or first == "e" or first == "i" or first == "o" or first == "u":
        new_word = word + pyg
        print new_word
    else:
        length = len(word)
        new_word = word[1:length] + word[0] + pyg
        print new_word
else:
    print 'empty'

 

 

 

Screenshot:

This is the screenshot of the sample code.

Screen Shot 2013-11-09 at 4.57.38 PM

Leave a Reply

Your email address will not be published. Required fields are marked *