print 'Welcome to the Pig Latin Translator!'
# Start coding here!
original = raw_input("Enter a word:")
if len(original) > 0 :
print raw_input
else:
print "empty"
这就是翻译所说的:
File "python", line 8
else:
^
SyntaxError: invalid syntax
我做错了什么?
答案 0 :(得分:4)
else 的缩进必须跟随 。
这对于Python来说一般来说,缩进很重要。
print 'Welcome to the Pig Latin Translator!'
# Start coding here!
original = raw_input("Enter a word:")
if len(original) > 0:
print raw_input
else:
print "empty"