Question: I want to remove the non digits in data and put it in a python list, but when I try to execute the loop it raises "IndexError: list assignment index out of range"

why ? its iterating along the b variable that have the same length that the data has. 

```
data = ['1A', '1B', '2', '3A', '3B']
b=range(len(data))
pt=[]    
for x, i in zip((data), b):
    pt[i]=(''.join(c for c in x if c in digits))

```

Answer: 
Instead of

```
 pt[i]=(''.join(c for c in x if c in digits))

```

use 

```
pt.append((''.join(c for c in x if c in digits)))

```

The reason the first does not work because `pt[i]` requires that there exists `i`-th element of the list `pt`.

Actually, you can rewrite your code to be much simpler:

```
pt=[]    
for x in data:
    pt.append((''.join(c for c in x if c in digits)))

```

or even simpler using *list comprehension*:

```
pt = [(''.join(c for c in x if c in digits)) for x in data]

```
```
digits ="0123456789"
data = ['1A', '1B', '2', '3A', '3B']
pt=[]
for i, x in enumerate(data):
    pt.append((''.join(c for c in x if c in digits)))
print(pt)

```

Is this what you're after?