4/11 works but dont understand why!


#1

Hi code works but dont know why!

I want to display the false statement if no string...


#2

Hi @arraywhiz88287 ,

The raw_input function displays a prompt, and returns what the user enters, in response. Instead of the two statements that you have that refer to raw_input, do this ...

original = raw_input("Enter a Name: ")

Then, when the code executes, original will be assigned the string that the user enters.

For the if block, if the user enters a string with at least one character, Codecademy want you to do this ...

print original

But, for the else block, if the user enters an empty string, Codecademy wants you to do this ...

print "empty"

#3

thanks for the response @appylpye

I'm starting to understand I think?! but I'm getting a new error now!

can you advise on what the error means!

cheers


#4

Hi @arraywhiz88287 ,

You need to assign the result of the call to raw_input to original. To do that, replace these two lines ...

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

... with just this one line ...

original = raw_input("Enter a Name: ")

Then, display the value of original. To do that, instead of this ...

print raw_input

... use this ...

print original

Also, instead of this ...

print "Type your name dummy"

.. Codecademy wants you to display "empty" by doing this ...

print "empty"

#5

Man I was kind of sitting here feeling stupid. I thought that was how raw_input() worked so I was trying things like just printing input like it was some thing I had forgotten. Nope just completely forgot that the entire point of them entering text was to save it to that variable. Once I have the text (the check is true) then I can clearly print the variable I just made and checked. Anyhow storytime aside thanks for your comment it helped me.