Check Yourself!


Hi, my code works and I'm able to move to the next exercise, but there's something I don't think should be happening.

If I write the code, click "Save & Submit Code" and do not write anything I get:

Welcome to the Pig Latin Translator!
Enter a word:


The "empty" appears because I didn't write anything, right?
But if I do write something, I get:

Welcome to the Pig Latin Translator!
Enter a word: word


Exactly the same thing, except I wrote something and the "empty" still appears below.
Is it supposed to be like this? Am I doing something wrong?

print 'Welcome to the Pig Latin Translator!'

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


If you are on the check yourself lesson you should also check if it only contains only letters using the isalpha() python method.

And remove the first raw_input()


why do you have raw_input twice? You only have to prompt the user for a single word


I don't know why you both told me to "remove the first first raw_input()", the exercise started with it, I only had to add the if statements.

Also I haven't seen anything teaching me about this isalpha() method yet. This exercise doesn't mention it so I don't know why it should be a requirement.
Still, my question wasn't answered.

I've edited the topic to add a link to the exercise.


For one, an input should be stored in a variable this one is not,

second of all in the check yourself lesson they do explain and tell you to include the .isalpha() method, read carefully :slight_smile:


The question is asking that ensure the user actually typed something. So the answer would be like? Not sure if I explain this clear enough.

original = raw_input("What's your name") #First they ask the user type something.
print 'Welcome to the Pig Latin Translator!' #Welcome the user.

if len(original) > 0: #len(original) syntax from words to numbers, example Uvewewe 7 letters and the fact is 7 > 0 = True.
    print original #Because it is TRUE, so python didn't skip the first print.
else: #But when if len(original) > 8 = False.
    print "empty" #Finally Python print "empty".

Hope this help. :grinning:



you did it perfectly for the lesson, you just forgot to add in the variable.

empty_string = ""

Just define it under the comment!


you can show how do it please y have this code

print "Bienvenido al traductor de espanol a Pig Latin."
print "ingrese la palabra a traducir"
original = raw_input("ingresa una palabra:")
if len(original)>0:

and produce this error
File "python", line 4
if len(original)>0:
IndentationError: unexpected indent

iḿ question for this but don't have an answer that helpme
and i'm searching but only find codes some that my

(sorry my english is not good... i'm speak spannish)


2 posts were split to a new topic: Check yourself


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