Help with my python code

Hi everyone,
I’m new to python and I’m trying to learn as much as I can. Here I’m trying to look for a specific name and assign it one of the values from Area or From Volume. As output, I want the same MatName List and one single list of matching values

Here below is a screenshot of the error I’m getting and the text of the script. Thank you for you valuable help.

Load the Python Standard and DesignScript Libraries

import sys
import clr
from Autodesk.DesignScript.Geometry import *

The inputs to this node will be stored as a list in the IN variables.

dataEnteringNode = IN
matname = IN[0]
matarea = IN[1]
matvolume = IN[2]

mat =
matnameout =
matout =

Place your code below this line

if matname == “C” :
mat = matarea
mat = matvolume


Assign your output to the OUT variable.

OUT = (matnameout, matout)

The error states that you have a new line when python was not expecting one because you’re missing the : on your else statement.

1 Like

oh XD! Its working now! you are a life saved Nick, thank you again for your valuable help :slight_smile:

1 Like