Hi,

I am new to Python and I am starting to learn about dynamic programming. I was going through an example on how to do value function iteration in stochastic environment. This is the code for the loop for simple neoclassical growth model, with two states capital K and productivity A (where Nk and Na denote the number of grid points, respectively):

I have some trouble understanding how Python stores the results: in this case, utility would be initially Nk by (Na x Nk) matrix, if stacked horizontally rather than vertically as in this example here (slide 31). So, my question is does U[:,j]=u(c) in the code above rewrite u(c) for each state Na as a column vector, or how does it work?

Thanks in advance!