当我编译下面的 Python 代码时,我得到
IndentationError: unindent 不匹配任何外部缩进级别
import sys def Factorial(n): # Return factorial result = 1 for i in range (1,n): result = result * i print "factorial is ",result return result
为什么?
其他海报可能是正确的……您的标签中可能混有空格。尝试进行搜索和替换以用几个空格替换所有选项卡。
尝试这个:
import sys def Factorial(n): # return factorial result = 1 for i in range (1,n): result = result * i print "factorial is ",result return result print Factorial(10)