0
Why is it concatenating rather than adding?
From array import * arr = array('i',(1,2,3)) arr1 = array('i',(4,5,6)) arr2 = arr + arr1 Print(arr2)
4 Answers
+ 4
If you just want to (mathematically) add 2 python arrays, you can do:
print([sum(x) for x in zip(arr, arr1)])
#[5, 7, 9]
An other option would be to use map() with module operator, that has a function add() that can do the same.
But why you are not using lists instead of python arrays?
+ 2
Because it is suppose to concatenate only
https://www.programiz.com/JUMP_LINK__&&__python__&&__JUMP_LINK-programming/array
0
đđ˘đ˘đđ¨ đđĄđđ˛đđĽ what if i don't want to use numpy and use simple ide?