In Pop Quiz! I don't get the answer I expected


#1



https://www.codecademy.com/en/courses/python-beginner-2W5v7/0/6?curriculum_id=4f89dab3d788890003000096


After "Enter a word:" I typed "hello guys".


No error messages, but the terminal printed "empty", while I expected it to print "hello guys", because it satisfies the if condition: its length is > 0 and it only contains alphabetical characters.
I thought that maybe this is due to the fact that I entered to words instead of one, and the space is counted as a non-alphabetical character, am I right?


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"


#2

a space is not a alphanumeric character


#3

Thanks! I suspected it.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.