Subtract a number from a list

Hello, I am a new Dynamo user . I would like to know how I can subtract the “X” from all the elements in “List1” as shown below. I have tried different methods but ended up getting float errors and "list not iterable " when I use the for loop in python script.

Hi,

Sounds like one or several of your inputs are strings.

Are you making sure the number you are subtracting is a float/double? You cannot subtract an integer from a float. To turn an integer into a float, just add a decimal and 0 to the end:

2 Likes

Thanks a lot for the reply mann! But i still didn’t understand it properly. I am subtracting two items which are float. Even when I select one item from my list I am getting null as result. As shown below, could you please help me out!

Could you please show us the types of the two items you are subtracting ? Use the Object.Type node.

Could you also test the subtraction in a CodeBlock (not using the node you are currently using) ?

I finally found the error using the Object.Type node, I was trying to subtract different types of items. Thanks a lot for the help guys! Appreciated !