diff --git a/EquilibriumIndex.py b/EquilibriumIndex.py index b691b90..54540df 100644 --- a/EquilibriumIndex.py +++ b/EquilibriumIndex.py @@ -1,2 +1,11 @@ def eqindex(data): - #do code here + indices = [] + left, right = 0, sum(data) # initiate left and right sums + for index, current in enumerate(data): + right -= current # keep running total of right sum + if right == left: + indices.append(index) + left += current # keep running total of left sum + if not indices: + return None + return indices