Why isn't my code working?


#1



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


every time I go to enter a number that not alphabetical it still returns that number instead of leaving it empty like the exercise is showing


I expect it not to return the number I entered because it's not alphabetical


**Here is my code**

print 'Welcome to the Pig Latin Translator!'

# Start coding here!
original = raw_input('Enter a word:')
print original
if original.isalpha() and len(original) >0:
    print original
else:
    print "empty"


#2

your line after your raw_input code, will ALWAYS print whatever you enter, then after that you have your IF statement, which will print "empty" if you enter anything else than a string.


#3

Duh. Thanks for the help!


#4

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