5. Factorial Help Required


Why is my code not working? It gives the correct answer every time I modify x. For example, when x is 4, it returns/prints 10.


def factorial(x):
    for i in range(1, x+1):
        total += i
    return total
print factorial(4)


Please disregard my post above. I misunderstood what a factorial was. Thought it added each time instead of muliply.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.