Hel with 4. Check Yourself!


I think I have a good code but still is cominicate that it is something wrong.
Please give me some advise or wright code

My code

print 'Welcome to the Pig Latin Translator!'

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


Hi there! I just pulled up the "4. Check Yourself!" lesson, and it appears that you code is practically the same as mine. In fact, when you run it, it would work if Python didn't rely on indentation.

If you are familiar with other languages, the often use something like curly brackets to say "this is what you do when the if triggers"

Python doesn't have any of that. It needs you to put a couple spaces before lines in loops and stuff - like the stuff inside your if statement.

So, if you try this:

print 'Welcome to the Pig Latin Translator!'

# Requesting Input
original = raw_input("Enter a word.")

#Checking if input is of nonzero length
if len(original) > 0:
    print original
    print "empty"

it should work.


Thank you :slight_smile:


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