Why it said I delete the variable called original accidentally?


#1



original = raw_input("Enter a word:")
if len(original) > 0:
print "original"
else: 
print "empty"


#2

Is this all your code? Because if it is then the only problem with your code is improper indentation,

should be indented,

original = raw_input("Enter a word:")
if len(original) > 0:
    print "original"
else: 
    print "empty"

#3

Thank you, I will try your code.

Probably I forgot the space in front of print?


#4

I tried your code, and I proceed successfully.

Thank you so much!


#5

With the quotes, this does not work properly ...

print "original"

Instead of displaying the value of the variable, original, it displays the string, "original".

Even if it passes Codecademy's test, it is not what the instructions ask the user to do.


#6

I just press the enter key and I get passed.

What else am I supposed to do under the instruction?

Cheers!


#7

@fred.y.liu ,

Even if your code passed, there is a little modification that can be made to conform to this instruction ...

If the string actually has some characters in it, print the user's word.

Just change this ...

print "original"

... to ...

print original

Then, after you submit the program and enter a word, it will display the evaluation of the variable, original, which refers to the word you entered.

In the exercises that follow, you will be adding code that translates your input into Pig Latin.


#8

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