The code that I made creates an infinite loop. I understand why it creates an infinite loop, but I do not know how to stop it from happening. Please help me get out of this infinite loop.
I want it to start working
def factorial(x): if x == 0: return 1 elif x == 1: return 1 elif x == 2: return 2 else: total = x while x >= 2: total = total * (x-1) return total print total