Pyg Latin:check yourself, can't print original

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>
Hey guys.
my coding seems perfectly fine, but It only works if there is NO characters written.
When I test it with a character, it says this error message:
“Oops, try again. The original variable (“j”) had more than 0 characters but did not get printed.”
I’ve looked on this page for a while, but still can’t find anything like mine.
Please help.
<What do you expect to happen instead?>

```python print 'Welcome to the Pig Latin Translator!'

original = raw_input(“enter a word:”)# Start coding here!
empty_string = “”

if len(empty_string) > 0:
print original

else:
print “empty”

<do not remove the three backticks above>

This line should be original instead of empty_string…

original = ""

1 Like

And also here replace empty_string for original

Thank you so much!
I understand now!
I would send you cake…
If I could.

/%%%%%% /
/__________/

close enough.
1 Like

Haha :sweat_smile: You’re welcome!

Hi, I’m stuck here any idea on what I’m doing wrong ? This is the error message I’m getting
“File “python”, line 6
else:
^
SyntaxError: invalid syntax”

print ‘Welcome to the Pig Latin Translator!’

original=""
if len (original) > 0:
print original
else:
print “empty”# Start coding here!

original=raw_input (“What is your name?:”)
print original

This part should come right after this

And remove the print original next to it

This is what my script looks like before I write the code:

print ‘Welcome to the Pig Latin Translator!’

Start coding here!

original=raw_input (“What is your name?:”)
print original

I’ve tried what you said and it’s still giving me errors.

print 'Welcome to the Pig Latin Translator!'

original = raw_input("enter a word:")# Start coding here!
original = ""

Does your code begin like this?

print ‘Welcome to the Pig Latin Translator!’

Start coding here!

original=raw_input (“What is your name?:”)
print original

This is exactly the way it begins.

Okay now after that have you written your if statement to check the length of originaal?

if len(original) > 0:
    print original

else:
    print "empty

print ‘Welcome to the Pig Latin Translator!’

Start coding here!

original=raw_input (“What is your name?:”)
print original
original =""
if len (original)>0:
print original
else:
print “empty”

that’s my full code , then I get this error message "Oops! Did you accidentally delete the variable called original?:

Then on the right of the small screen this is the error message I receive, ’ File “python”, line 10
else:
^
SyntaxError: invalid syntax’

Remove the print original after raw_input() line.

Done that still get the same error

Then its probably your indentation… Indent like this

print 'Welcome to the Pig Latin Translator!'

# Start coding here!
original = raw_input("Enter a word:")


if len(original) > 0:
    print original
else:
    print "empty"

Awesome. It worked! Thanks man

1 Like

bandit didnt give you correct answer, you could simply double check printed results in the console. It should look like this:
print ‘Welcome to the Pig Latin Translator!’

original = raw_input(“Enter a word:”)
if len(original) > 0:
print original
else:
print “please fill in the word”

I disagree with your reply seeing as my answer is 100% functional.

thx it helps a lot i was stuck