Question: I'm trying to make a program that will check if two numbers have the same digits but in different order. For example, 232 and 223 will print "true" but 123 and 223 will print "false".
Now I have no mistakes but the answer should be "true" and it's not:

my code:

```
a=322 
b=223

list_a = list(str(a))
list_b = list(str(b))
c=len(str(a))
d=len(str(b))

j=0

if c != d:
    print "false"
else:
    for i in range(len(list_a)):
        while j<d:
           if i == list_b[j]:
            list_b.remove(list_b[j])
            break
           j=j+1
        j=0

if list_b==[]:
    print "true"

```

Answer: 
You can use the Counter object to obtain the fingerprint of each digits string, and then just compare the two fingerprint, that's all of it:

```
In [1]: n1 = 123

In [2]: n2 = 312

In [3]: n1, n2 = map(str, [n1, n2])

In [4]: n1,n2
Out[4]: ('123', '312')   

In [5]: from collections import Counter

In [6]: c1 = Counter(n1)

In [7]: c2 = Counter(n2)

In [8]: c1 == c2
Out[8]: True

In [9]: c1
Out[9]: Counter({'1': 1, '3': 1, '2': 1})

In [10]: c2
Out[10]: Counter({'1': 1, '3': 1, '2': 1})

```

If you are not care about the number of digits in the string, you can use the set builtin type to obtain the fingerprint:

```
In [13]: n1 = 112

In [14]: n2 = 212

In [15]: n1, n2 = map(str, [n1, n2])

In [16]: s1 = set(n1)

In [17]: s2 = set(n2)

In [18]: s1
Out[18]: set(['1', '2'])

In [19]: s2
Out[19]: set(['1', '2'])

In [20]: s1 == s2
Out[20]: True

```

The only work you should do is just find some kind of Fingerprint!
`i` variable in your snippet is string, not integer, that's why you have `TypeError`. Change 

```
if list_a[i] == list_b[j]:

```

to

```
if i == list_b[j]:

```

If you wan to use `i` like index, change `for` loop like so:

```
for i in range(len(list_a)):

```

Also, indices in python start from 0, not from 1, so change 

```
j = 1

```

to 

```
j = 0

```

One more correction: 

```
while j <= d:

```

to

```
while j < d:

```

So you won't have index-out-of-range.

Also this one: 

```
list_a = list(str(a))
list_b = list(str(b))

```