5. Factorial


i am having trouble with this factorial thing. Can anyone please help me please?


Oops, try again. factorial(1) returned [1] instead of 1
the console window says none

def factorial(x):
    total = []
    answer = 1
    def listing(x):    
        while int(x) > 0:
            x -=  1
        return total
    return listing(x)
    def multiplying(x):  
        for n in total:
            answer *= n
            return answer
    return multiplying(x).


use a recursive function.


If you don't know what I mean you can go to Youtube Khanacademy has videos on it. https://www.youtube.com/watch?v=o920mj0NbhE&t=16s :slight_smile:


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