Translator is not following input conditions


Code still prints input when there is a number in them and conditions are put in place to deter inputs from being printed if there is a number in it. I get the message
" Oops, try again. It looks like your code prints original ("ijncs7") when original includes non-alphabetical characters. ," even though I have the " and ___.isalpha() " portion.

I expected the input not to be printed because it had a number in it which .isalpha() was supposed to weed out.

Replace this line with your code. 
print 'Welcome to the Pig Latin Translator!'

# Start coding here!
original = raw_input("Enter a word:")
print original

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



I went through my codes and there is one difference between us -

I do not have a duplicate of 'print original'.

In lesson 4 (Check Yourself!) - it states

Add an if statement that checks that len(original) is greater than zero.
If the string actually has some characters in it, print the user's word.
Otherwise (i.e. an else: statement), please print "empty".

I hope that helps.


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