Using .isalpha() in PygLatin 5. Check yourself some more


#1

Code returns this error: Oops, try again. It looks like your code prints original ("2") when original includes non-alphabetical characters.

How can I have only alphabetic characters returned when a word is input using .isalpha()?

Here is my code for reference:

print 'Welcome to the Pig Latin Translator!'
name = raw_input("What's your name")
print name
raw_input("Enter a word:")
original = raw_input("Enter a word:")
print original
empty_string = ""
if len(empty_string) > 0 and empty_string.isalpha():
print ""
elif len(empty_string) == 0:
print "empty"

else:
print "Please enter a word"


#2

We do not need a variable, empty_string, only original. If len(orginal) is 0, then original is the empty string.

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