AnsweredAssumed Answered

Python Loop Addition

Question asked by MBDriscoll on Mar 31, 2017
Latest reply on Apr 3, 2017 by MBDriscoll

I am using a search cursor to get some values.  After I would like to add the next total to the total of all the results before it in order.  Not sure what to do, iterate, range, re-loop?

 

Example:

[a,b,c] would result in [a, a+b, a+b+c]

[3,5,2,3] would result in [3, 8, 10, 13]

 

 

value = ""
with arcpy.da.SearchCursor("Feature", "Field") as curs:
for row in curs:
value = row[0]

 

Use the values in "value" to do what I want.

 

The script will run in ArcGIS Pro.

Outcomes