Monday, July 7, 2014

Day 93

Python at CodeCademy. Worked on Python tutorial 11 of 11, PygLatin, Testing, Testing, is This Thing On? Completed tutorial and tested out the code.

The code used:
pyg = 'ay'

original = raw_input('Enter a word:')

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

The interaction for this code looked like this:
Enter a word: Pig
igpay

Enter a word: Latin
atinlay

Enter a word: 123
empty

No comments:

Post a Comment