IndentationError: unindent does not match any outer indentation level

后端 未结 30 2032
Happy的楠姐
Happy的楠姐 2020-11-21 07:48

When I compile the Python code below, I get

IndentationError: unindent does not match any outer indentation level




        
30条回答
  •  南笙
    南笙 (楼主)
    2020-11-21 08:40

    Other posters are probably correct...there might be spaces mixed in with your tabs. Try doing a search & replace to replace all tabs with a few spaces.

    Try this:

    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)
    

提交回复
热议问题