https://www.codecademy.com/courses/learn-python/lessons/practice-makes-perfect/exercises/factorial

Hi everyone!

I’m new to this forum, but very happy I found it! I’m also new to coding, so I still have much to learn.

I was trying to solve the factorial problem of the loops module ‘Practice makes perfect’, but didn’t get the result I wanted. Of course, I have seen the solution by now, but I’d like to understand why my code doesn’t work, so I don’t make mistakes like these in the future! Anyone that could help me?

```
def factorial(x):
total = 1
for number in range (1, x+1):
total *= number
return total
print factorial(6)
```

Thanks in advance!