How to add items within a list

Hi I want to ask that how can we add the entries within a list to get single amount or number without single outing each entry using index and adding them separately. plz ASSIST

Try the Math.Sum node.

1 Like

Hi @asfand.cem20nit,

You may create a basic python code to get the sum of those numbers in your list. Below is one way to add them up:

import sys
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *

numList = IN[0]

def sumNums(Args):
return sum(i for i in Args)

Total = sumNums(numList)

OUT = Total

Capture

hope it helps!