How to multiply and add data in two lists?
like this
0 X 1 + 43.18 X 3 + 33.24 X 0 +…+ 43.185 X 81 + 0 X 9 + 17.03 X 37 +…
You can use zip()
function in Python node and loop over the levels:
i.e:
for i,j in zip(list1, list2):
Do it once more in loop to multiply the values.
You can match the indices and elements. After that you can get what you want.
1 Like
1 Like
Thank you very much!
Thanks!
To multiply you can do something like this:
a
=
[
1
,
2
,
3
,
4
]
b
=
[
5
,
6
,
7
,
8
]
result
=
[num1
*
num2
for
num1, num2
in
zip
(a,b)]
print
(
'Multiplication result is: '
, result)
This will multiply the lists items irrespective of their size. Here is the full article:
How to multiply two lists in Python?