How can I get the most optimal combinations of numbers (dimensions from an existing list) in order to reach a target (already known)

Hello Michael_Kirschner2, I am trying to do it in python and it is currently working when I try to print the results in the console, but, the bad part is that when i try to reproduce it on dynamo, I am having problems defining the variables, would you please help me correct it?

I posted what i am doing on this forum on this particular thread