Tuesday, July 1, 2014

Day 87

Python at CodeCademy. Worked on Python tutorial 5 of 11, PygLatin, Check Yourself... Some More! Worked with "and" command and "isalpha()" funtion.

The code used:
print 'Welcome to the Pig Latin Translator!'

original = raw_input("Enter a word:") 

if len(original) > 0 and original.isalpha():
    print original
    
else:
    print "empty"

The interaction for this code looked like this:
Welcome to the Pig Latin Translator!
Enter a word: abc
abc

and

Welcome to the Pig Latin Translator!
Enter a word: 123
empty

No comments:

Post a Comment