Hello. After doing some research I was able to complete the lesson. It left me confused though. I don't know if I missed something or what. Can someone please help me to understand why the code below works. When I read it "logically" with an input of 4, I come up with 12. Why does it work to achieve the correct answer of 24. Does the If/else statement keep running through until it gets to 0? If someone could help me understand it that would be great.
It probably sounds like a noob question, but its probably because I am!
def factorial(x): if x == 0: return 1 else: return x * factorial(x-1)