Check yourself some more - help!


#1

I'm stuck on 5. Check yourself some more...:

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

Here is the code I'm using:


print 'Welcome to the Pig Latin Translator!'
original = raw_input("Enter a word.") 
print original
if len(original) > 0 and original.isalpha():
    print original
else:
    print "Empty"

The error I get is "Oops, try again. It looks like your code prints original when original includes non-alphabetical characters."

It looks to me like I'm using the isalpha() properly, but clearly it isn't working -- any advice?


#2

the first "print" in line 3 is unnecessary,you only print it after you check it using .isalphal and len()


#3

That was just me following the directions step by step (it initially wanted me to spit the original word back out). I'm more concerned about the alpha check not working properly


#4

I have typed this

print 'Welcome to the Pig Latin Translator!'

original = raw_input("Enter a word:")
original =""

if len(original) > 0 and original.isalpha():
print original
else:
print "empty"
and i get the error message

File "python", line 7
print original
^
IndentationError: expected an indented block
why do i get this error?


#5

did you press tab before the print statement?


#6

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