Pyg Latin:check yourself, can't print original


#1



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.


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"


#2

This line should be original instead of empty_string...

original = ""


#3

And also here replace empty_string for original


#4

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

~~~~~~~~~~
/%%%%%% /
/__________/

close enough.


#5

Haha :sweat_smile: You're welcome!


#6

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


#7

This part should come right after this


#8

And remove the print original next to it


#9

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.


#10
print 'Welcome to the Pig Latin Translator!'

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

Does your code begin like this?


#11

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.


#12

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

#13

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'


#14

Remove the print original after raw_input() line.


#15

Done that still get the same error


#16

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"

#17

Awesome. It worked! Thanks man


#18

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"


#19

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


#20

thx it helps a lot i was stuck