0

I get a syntax error in my if statement:

print "Welcome to the English to Pig Latin translator!"

original = raw_input("Please enter a word to be translated: ")
word_length = len(original)

def length_check():
    If (word_length) > 0 : <-- This colon brings up the following error:
        return original


File "python", line 7
    If (word_length) > 0 :
                         ^
SyntaxError: invalid syntax

1 Answer 1

5

If should be changed to if. Observe the lowercase i.

>>> If True:

SyntaxError: invalid syntax
>>> if True:
        print True


True

You may want to read up The Python Doc's entry on Control Flow.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.