0 python if-statement syntax-error
我的if语句中出现语法错误:
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
Run Code Online (Sandbox Code Playgroud)
If应改为if.观察小写i.
>>> If True:
SyntaxError: invalid syntax
>>> if True:
print True
True
Run Code Online (Sandbox Code Playgroud)
您可能想要阅读关于控制流的Python Doc的条目.
| 归档时间: |
|
| 查看次数: |
263 次 |
| 最近记录: |