Question: I have post the similar question before,but this time the problem is different,I got stuck with the following code..can anyone help with it?thanks in advance

I have fixed mu code as suggested,thanks

```
from numpy import *
#vs,fs,rs are all m*n matrixs,got initial values in,i.e vs[0],fs[0],rs[0] are known
#want use this foor loop to update them
vs=zeros((10,3))
vs[0]=([1,2,3])
fs=zeros((10,3))
fs[0]=([2,3,4])
vs=zeros((10,3))
vs[0]=([3,4,5])
for i in range(5):
    #start looping..
    vs[i+1]=vs[i]+fs[i]
    fs[i+1]=(rs[i]-re[i])
    rs[i+1]=rs[i]+vs[i]
print vs,fs,rs

```

then this code gives vs,fs,rs in different i,but not update each rows of rs,fs,vs and return me a single array of rs,fs,vs (fully updated). whats the problem here?..what should I add?thanks

Answer: 
Put your inizialization **outside** the loop! Right now, you're resetting the arrays to all zeros **each time through the loop**, over and over, which is absurd. You also appear to have a typo -- you set vs twice and rs never -- so I've tried to guess what you meant.

```
from numpy import *

#vs,fs,rs are all m*n matrixs,got initial values in,i.e vs[0],fs[0],rs[0] are known
#want use this foor loop to update them
vs=zeros((10,3))
vs[0]=([1,2,3])
fs=zeros((10,3))
fs[0]=([2,3,4])
rs=zeros((10,3))
rs[0]=([3,4,5])

for i in range(5):
    #start looping..
    vs[i+1]=vs[i]+fs[i]
    fs[i+1]=rs[i]-re[i]
    rs[i+1]=rs[i]+vs[i]
    print vs,fs,rs

```
You do not start looping where the comment indicates it, but at the `for i in range(5):` line. Everything in the indented block (the "body of the for-loop") is done repeatedly for each `i`. So setting `vs` and `fs` to zero is done repeatedly, each time deleting what was calculated before. These initializations should be done before the `for`.

Also `vs` is initialized twice while `rs` isn't initialized at all, probably that's a typo and it should look like this:

```
vs=zeros((10,3))
vs[0]=([1,2,3])
fs=zeros((10,3))
fs[0]=([2,3,4])
rs=zeros((10,3))
rs[0]=([3,4,5])

for i in range(5):
  #start looping..
  ...

```