I’m wondering if how I’m thinking about this problem works. I keep getting indentation errors, and ended up seeing the solutions and ofc it’s short and sweet lol. The solution has every indent 2 tabs (4 spaces). I’ve been using 1 tab and it’s been working fine. I don’t remember ever having to switch to 2 tabs.
The problem asks to create a function that returns the factorial of an integer x.
def factorial(x): n = 0 for i in len(range(0, x)): while n <= x: y = 1 * (n + 1) return y n += 1 else: return x