Factorial code not working , help needed


#1

def factorial(x):
i = 1

if x == 0 or x == 1:
    return 1
elif x > 1 :
    for c in range(x):
        if c != 0 and c != 1:
            i=i*c

return i

if x = 0 or x = 1 it will return 1
if c is in range 0 to x and c > 1 it should return I*2*3*...(x-1)(x) right?
why doesnt this work??
im [edit] confused please help.
`


#2

Please explain, what part of the logic necessitates the above?


#4