Answers for "how to add n elements to the end of an array in python"

1

how to add to the end of an array python

array = [1 , 2, 3]
print(array)

array.append(4)
print(array)

#[1 ,2 ,3]
#[1 ,2 , 3, 4]
Posted by: Guest on June-22-2020
0

add 1 to all elements in array python

import numpy
a = [1, 1, 1 ,1, 1]
ar = numpy.array(a)
print ar + 2
Posted by: Guest on October-02-2021

Code answers related to "how to add n elements to the end of an array in python"

Python Answers by Framework

Browse Popular Code Answers by Language