Factorial !:help!


def factorial(x):
    while count>1:
    return total
print factorial(3)


well, total is defined in the loop, so it will simply be assigned a new value (overwriting the previous value), not adding the value total, so total is never a true total

define total outside the loop so you can add values to it so you end up with the factorial


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