5/15 Factorial


Hey im stuck on this one part, what exactly am i doing wrong with my code?

def factorial(x):
    factorial_x = [x]
    while x > 1:
        reduced_x = x - 1
    for num in factorial_x:
        product_x = 1*num
    return product_x


x should always be greater than one, as you never decrement it.


As you have declared these variables inside of loops, their values will 'reset' each time the loop runs.

I would highly recommend doing this exercise with a range(). :slightly_smiling: