Check Yourself!


#1



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


The interper says Oops! Did you accidentally delete the variable called original?


I thought this was the right answer, PLEASE HELP!


Here is the code:
Replace this line with your code. 
print 'Welcome to the Pig Latin Translator!'

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


#2

Look at the spelling in your if statement.


#3

That's not the only thing, this:

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

should be one line, like this:

original = raw_input("Enter a word:")

#4

thanks the code worked :grin:


#5

Also, unless you left this part of your code out of your initial post, It would appear that you did not complete steps two and three of the instructions:

Step 2: If the string actually has some characters in it, print the user's word.
Step 3. Otherwise (i.e. an else: statement), please print "empty".


#6

thanks for your help :smile:


#7

No problem. If you have any issues with those steps, just ask.


#8

Strange one, this passes:

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

I know why it passes, but it shouldn't be able to. Heck, you don't even need to use raw_input() to pass. Or the if statement for that matter.


#9

That is weird. Frankly, Codecademy's SCT is just weird in general.


#10

OK, it's now decided I do need the if statement, but not the else or the raw_input. As you say, the STC isn't bullet proof.


#11

The SCT does indeed have its flaws, but to exploit those flaws is inadvisable. We would much rather prefer you follow the instructions to build functioning code that you can understand, rather than exploiting the SCT merely because you can.


#12

Of course, I wasn't suggesting to, more pointing out the original code very nearly passed without actually doing what was required.


#13

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