python - How do I add one more loop to this? -
part of code is:
list1 = zeros((x,y)) j in range(1,y): in range(1, x-1): list1[i,j] = list1[i,j-1] + equation
this works fine. however, when want next stage, need modify "equation" part in second loop. equation (a*b+c)*d
, wish make 1 of parameters(a,b,c,d)
varying every increase in j
.
that is, when j
1, a = something
. when j
increases 2, changes according. function of j
. example: a = a*cos(w*j)
.
my problem is, how loop relation code a
updated every time?
just add expression in outer loop, calculating a
based on changing value of j
:
for j in range(1, y): = * cos(w * j) in range(1, x-1): list1[i, j] = list1[i, j - 1] + (a * b + c) * d
Comments
Post a Comment