当我编译下面的Python代码时,我得到
IndentationError:unindent与任何外部缩进级别都不匹配
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)