0
$\begingroup$

I would like to replicate the following python code in animation nodes:

a = [1,2,3]
c = []

for i in a:
    for k in a:
        c.append(i*k)
print(c)

The output is [1, 2, 3, 2, 4, 6, 3, 6, 9].

However in animation nodes I can not make this work. Below is my current nodes setup: enter image description here (I know that this could be done in AN in a simpler way however I need something like this for a more complicated project.)

$\endgroup$
1
1
$\begingroup$

If this is a simple case, like in your question, you can also use "expression" node and avoid nested loops.

enter image description here

$\endgroup$
1
$\begingroup$

You can do something like this:

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.