Flowchart About Looping

40 views Asked by At

how to make a flowchart from this python code below

sum_hessian = 0.0
for idx in lhs_indices:
    sum_hessian += hessian[idx]

and the value of hessian and lhs_indices are below:

hessian = [0.5, 0.8, 1.2, 0.3, 2.0]
lhs_indices = [1, 3, 4]

expected process of each iteration are below:

(idx = 1): sum_hessian = 0.0 + 0.8 = 0.8
(idx = 3): sum_hessian = 0.8 + 0.3 = 1.1
(idx = 4): sum_hessian = 1.1 + 2.0 = 3.1

Thank you

I haven't found an example of a flowchart for that loop. I'm confused about how to make it, I think that is different from loop that usually used, with format for i=0, i<3, i++.

0

There are 0 answers