I tried this code extend method , some how my code is not working my_array = array('i', [1,2,3,4,5]) my_extnd_array = array('i', [7,8,9,10]) my_array.extend(my_extnd_array)
i was getting error
Traceback (most recent call last):
File "<pyshell#25>", line 1, in <module>
my_extnd_array = array('i', [7,8,9,10])
NameError: name 'array' is not defined
Please refer to the error It's saying NameError: name `array` is not defined and it seems you have not imported the array module which is required for array creation.
You can try the given code.