How to use the .isalpha() function correctly
Luke Tomaneng
luketomaneng at gmail.com
Sun Dec 14 12:16:55 EST 2014
Here a very small program that I wrote for Codecademy. When I finished, Codecademy acted like it was correct, but testing of this code revealed otherwise.
--------------------------------------------------
print 'Welcome to the Pig Latin Translator!'
# Start coding here!
raw_input("Enter a word:")
original = str(raw_input)
if len(original) > 0 and original.isalpha():
print original
else:
print "empty"
--------------------------------------------------
No matter what I type in, the result is "empty." What do I need to do in order for it to accept words?
More information about the Python-list
mailing list