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

Hi guys - I am on this factorial problem and I am unsure why the code is not working.

The error says ‘factorial(2) returned 1 instead of 2’.

The x+1 in the range function, I believe it includes x but not including x+1?

Thanks in advance.