I am trying to find out if a number is a palindrome. My code is:

```
max = 10 ** n
length = 0
total = 0
for i in range (max):
    if i == i[::-1]:
        total += 1
        if len(i) == n:
            length += 1

```

The line `if i == i[::-1]:` gives the error `TypeError: 'int' object is not subscriptable`. n is an integer.