Please Help What am I doing wrong? 6. PygLatin 5.Check Yourself...Some More


#1

here is my code:
name = raw_input("Enter a word:")
original = raw_input("Enter a word")
if len(name) > 0:
print name
else:
print empty


#2

Hi xantoryu,

If I remember correctly, you are just at the beginning of the lesson where you are asking for input and determining if the input contains a word, or if it's blank/empty.

name = raw_input("Enter a word: ")

is classic Python for prompting. The user of the program will just see "Enter a word: " and will type their answer. If their answer is "John", for example, that will become the value in the variable name, the same as if you typed

name = "John"

(I don't remember/know why you are prompting for the variable original, so let's skip that for now.)

So the statement

if len(name) > 0:
    print name

is saying "If the person actually types some name --- instead of just hitting ENTER --- print that value in the name variable. Print "John", for example.

Now the next part:
else:
print empty
should be:

else:
    print "empty"

because empty without quotation marks makes Python think it's a variable, but it's not; it's a string --- it's just a word you want the program to print if the user doesn't input/enter any name.

I hope that helps. Good luck!