Wednesday, July 2, 2014

Day 88

Python at CodeCademy. Worked on Python tutorial 6 of 11, PygLatin, Pop Quiz! Tested current code, tried some inputs that should pass and some that should fail, entered some strings that contain non-alphabetical characters and an empty string.

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

# Start coding here!
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: 321
empty

Welcome to the Pig Latin Translator!
Enter a word: xYz
xYz

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

No comments:

Post a Comment