0
Is there any simple way to declare a null array of size n in python?
3 Respostas
+ 5
import numpy as np
arr = np.empty(10)
print(arr)
# the array is printed similar to a zero-like one, but in fact its values are not being initialized -- array-wise it is like it's full of 'None's
+ 2
array = [None] * n
#But I don't think you really want to declare the size of a list in Python in advance, since you can use the append method of list
+ 1
array=[]