5/15 I completed the task,but I do not understand it

  def factorial(x):
    k= x-1
      #stores numbers
    if x==0:        #two if statments for uneeded
        return 1
    if x==1:
        return 1
    number = str(x)    
    for y in number:     # supposed to reduce 
        original_value= int(number)
    return the_factorial
print factorial(20)

I don"t understand why factorial(x-1) works

def factorial(x):
list1 = []
result = 1
while x > 0:
    x -= 1
    for i in list1:
        result *= i
return result

That's how I solved it, maybe comparing the two might clear things up? looking at your code confuses me and it would take me a while to make sense of it, sorry. I rewrote my own code like 50 times, so ya


This is what I used. The instructions say "to calculate the factorial of a non-negative integer x"
I suppose if you wanted to make sure it wasn't a negative number or a float, you could change to:

for i in range(1, int(abs(x)) + 1):

That would just convert it to a positive integer