I'm having a problem with a bit of code, I feel like I must be missing something fundamental here. A simple example that gives the same error as I am having is as follows:

```
from numpy import array,zeros
x = array([1,2,3])
f = zeros(len(x))

for i in x:
    f[i] = x[i] + 1

```

And the traceback reads as follows:

```
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
C:\WINDOWS\system32\<ipython-input-5-6b6b88f30156> in <module>()
      1 for i in x:
----> 2     f[i] = x[i] + 1
      3 

IndexError: index out of bounds

```

This has been puzzling me for far too long, but I just can't seem to see what the problem is here? Could someone lend a hand?