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
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 .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.