Check Yourself... Some More


#1

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

My code works if I don't include any numbers in the response. If I type "Hello2" as an answer for example, it still prints "Hello2". I'm trying to use the isalpha(), but it doesn't seem like I'm using it properly. Thought it was supposed to stop any printing if the word typed includes anything besides letters.

The error I get when I type "Hello2" is:

"It looks like your code prints original ("Hello2") when original includes non-alphabetical characters."

What am I doing wrong?

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 "Thanks!"

elif len(original) == 0:
    print "empty"

else:
    print "You forgot to give me a word!"

#2

@klui121
what happens
when you kick out the code-line
print original


#3

One thing that may be affecting it are your initial variables. Try this. It worked for me regardless if I put numbers or a word in the prompt.

raw_input("Enter a word:")
original = raw_input("Prompt")
if len(original) > 0 and original.isalpha():
print original
elif len(original) == 0:
print "empty"
else:
print "Only type a word in the box."


#4

The comments don't allow me to put the right indention. Make sure you do that too.