Python Script, Processing a List

you are indeed. Your code only works on a singleton (i.e. one object, or in your case, a number). As you want to provide a list you need to store your result in a list and iterate over the input list. One method is a simple loop to iterate through the list (and python has some pretty powerful built-in itertools which you should check out on python.org which are more efficient than loops):

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

numberList = IN[0]

y = []
for x in numberList:
	if x < 75:
		y.Add(5)
	elif 75 <= x < 200:
		y.Add(10)
	elif 200 <= x < 500:
		y.Add(15)
	elif 500 <= x < 800:
		y.Add(25)
	else:
		y.Add(32)

#Assign your output to the OUT variable.
OUT = y
2 Likes