If by "array" you actually mean a Python list, you can use

a = [0] * 10

or

a = [None] * 10
Answer from Sven Marnach on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-initialize-empty-array-of-given-length
Python - Initialize empty array of given length - GeeksforGeeks
One of the most simplest method to initialize the array is by *Operator. In this example, we are creating different types of empty using an asterisk (*) operator. ... # initializes all the 10 spaces with 0’s a = [0] * 10 print("Intitialising ...
Published   July 12, 2025
🌐
TutorialsPoint
tutorialspoint.com › how-to-initialize-an-empty-array-of-given-length-using-python
How to Initialize an Empty Array of given Length using Python
August 14, 2023 - The program uses built?in method empty() that follow the numpy module to initialize the empty array with given length.
🌐
Vultr Docs
docs.vultr.com › python › third-party › numpy › empty
Python Numpy empty() - Create Empty Array | Vultr Docs
November 18, 2024 - Use numpy.empty() to create an array. ... This code initializes an array of length 3 with indeterminate values.
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.empty.html
numpy.empty — NumPy v2.1 Manual
Array of uninitialized (arbitrary) data of the given shape, dtype, and order. Object arrays will be initialized to None. ... Return an empty array with shape and type of input.
🌐
Quora
quora.com › In-Python-how-can-I-initialize-an-array-or-list-yet-to-be-populated-with-values-to-have-a-defined-size
In Python, how can I initialize an array (or list), yet to be populated with values, to have a defined size? - Quora
Answer: [code]a = numpy.empty(n, dtype=object) [/code]This creates an array of length n that can store objects. It can't be resized or appended to. In particular, it doesn't waste space by padding its length.
🌐
Note.nkmk.me
note.nkmk.me › home › python › numpy
NumPy: Create an empty array (np.empty, np.empty_like)
January 22, 2024 - Python's built-in list can also be converted to ndarray. For example, you can add elements to an empty list first and then convert it to an ndarray upon completion. ... If the final number of elements is already known, it is better to create an array of the necessary size using np.empty() or np.empty_like() and then assign values.
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › numpy empty array with examples
NumPy Empty Array With Examples - Spark By {Examples}
March 27, 2024 - You cannot resize an empty array. Once an array is created using numpy.empty(), its size and shape are fixed.
Find elsewhere
🌐
W3Schools
w3schools.com › python › python_arrays.asp
Python Arrays
Note: This page shows you how to use LISTS as ARRAYS, however, to work with arrays in Python you will have to import a library, like the NumPy library. Arrays are used to store multiple values in one single variable: ... An array is a special variable, which can hold more than one value at a time. If you have a list of items (a list of car names, for example), storing the cars in single variables could look like this:
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.empty.html
numpy.empty — NumPy v2.4 Manual
Array of uninitialized (arbitrary) data of the given shape, dtype, and order. Object arrays will be initialized to None. ... Return an empty array with shape and type of input.
🌐
Quora
quora.com › How-do-I-create-an-array-of-a-specific-size-in-Python
How to create an array of a specific size in Python - Quora
Answer (1 of 3): (1) In Python, you don’t typically work with arrays, but with lists. There are libraries to work with arrays, but you only use them for certain specialized purposes. Such as when you need matrix multiplication or some other advanced math, and want to do it quickly.
🌐
Note.nkmk.me
note.nkmk.me › home › python
Initialize a List of Any Size with Specific Values in Python | note.nkmk.me
August 20, 2023 - This article explains how to initialize a list of any size (number of elements) with specific values in Python. ... See the following article about initializing a NumPy array (numpy.ndarray). NumPy: Create an ndarray with all elements initialized with the same value · An empty list is created ...
🌐
NumPy
numpy.org › doc › 2.3 › reference › generated › numpy.empty.html
numpy.empty — NumPy v2.3 Manual
Array of uninitialized (arbitrary) data of the given shape, dtype, and order. Object arrays will be initialized to None. ... Return an empty array with shape and type of input.
🌐
Quora
quora.com › How-do-you-create-an-empty-multidimensional-array-in-Python
How to create an empty multidimensional array in Python - Quora
Answer (1 of 5): You can’t - a multidimensional list (not array) in Python is a list of lists. if the top level list is empty then it isn’t multidimensional - it is an empty list. if the list on the next level down are empty then you have a list which is N by zero - hardly multi-dimensional.
🌐
W3Schools
w3schools.com › python › numpy › numpy_creating_arrays.asp
NumPy Creating Arrays
A dimension in arrays is one level of array depth (nested arrays). nested array: are arrays that have arrays as their elements. 0-D arrays, or Scalars, are the elements in an array. Each value in an array is a 0-D array.
🌐
AskPython
askpython.com › home › 3 ways to initialize a python array
3 ways to initialize a Python Array - AskPython
January 16, 2024 - Python NumPy module can be used to create arrays and manipulate the data in it efficiently. The numpy.empty() function creates an array of a specified size with a default value = ‘None’.
🌐
Reddit
reddit.com › r/learnpython › why does numpy.empty put numbers on the order of 1^9 or 1^(-300) in the array?
r/learnpython on Reddit: Why does numpy.empty put numbers on the order of 1^9 or 1^(-300) in the array?
August 4, 2022 -

https://numpy.org/doc/stable/reference/generated/numpy.empty.html

It shows that the returned value of numpy.empty is an array with either very small numbers on the order of 1-300 or very large ones on the order of millions or billions.

Why doesn't it just return an empty array?

And why do they use these value instead of 0s? Don't these very small and large values actually take more space since there are more significant digits to represent? For an empty array we would want the lowest memory footprint which should be an array of all 0s.

How can using these numbers with many digits to be represented be faster than an array of all 0s (as the docs claim)?

Top answer
1 of 5
3
It's allocating the memory without initializing. The memory contains whatever was already there, which could be bits of a program or a string or anything at all. Interpreting those random bit patterns as numbers, it's not surprising they might happen to correspond to very large or very small exponents. So it's not "using" any values. That's just the numeric value that's displayed when the array element happened to be the 47,042-th pixel in the picture of somebody's cat.
2 of 5
3
The other responses are correct that empty creates an array by allocating some memory without overwriting the existing values, and then just interpreting that memory as an array. Something the other responses haven’t covered, Don’t these very small and large values actually take more space … ? No. Numpy arrays are created with a single datatype (the default for empty is float, but you can change it with the dtype parameter), and each value in the array has the same amount of memory allocated to it (which is part of why they’re fast to use and operate on). Computers store numbers as some encoding of bits (binary zeros and ones), and floating point is a special type of encoding that allows representing fractional numbers of varying sizes - effectively one bit is used for the sign (+/-), some of the bits are used to specify order of magnitude (how close or far a number is from zero), and the rest are used to specify the details / significant figures. All the bits are always used for the given datatype, but depending on the numbers you’re trying to represent some of the least significant bits won’t be meaningful to you / for your application. Accordingly, two 64-bit float numbers should have roughly the same number of significant figures, but a very large number will have most or all of its significant figures above the decimal point (when the number is converted to a decimal representation, for a human to read), and a very small number will have most or all of them below the decimal point. It’s a very clever way of being able to handle numbers with significant size variation, but does mean that numbers aren’t specified ‘exactly’ as a human would think about them. If you have an application that requires exact numbers of decimal points (that you choose) you can generally use integers that are some factor of 10 larger than their ‘real’ values. Alternatively there’s the decimal module, but calculations will be less efficient, and it’s not necessary for most applications - especially ones working with large arrays of numbers.
🌐
Reddit
reddit.com › r/learnpython › array length
r/learnpython on Reddit: Array length
August 14, 2022 -

A non-empty array A consisting of N integers is given.

Array A represents a linked list. A list is constructed from this array as follows:

the first node (the head) is located at index 0;
the value of a node located at index K is A[K];
if the value of a node is −1 then it is the last node of the list;
otherwise, the successor of a node located at index K is located at index A[K] (you can assume that A[K] is a valid index, that is 0 ≤ A[K] < N).

For example, for array A such that:

A[0] = 1 A[1] = 4 A[2] = -1 A[3] = 3 A[4] = 2

📷

the following list is constructed:

the first node (the head) is located at index 0 and has a value of 1;
the second node is located at index 1 and has a value of 4;
the third node is located at index 4 and has a value of 2;
the fourth node is located at index 2 and has a value of −1.

Write a function:

def solution(A)

that, given a non-empty array A consisting of N integers, returns the length of the list constructed from A in the above manner.

For example, given array A such that:

A[0] = 1 A[1] = 4 A[2] = -1 A[3] = 3 A[4] = 2

the function should return 4, as explained in the example above.

Assume that:

N is an integer within the range [1..200,000];
each element of array A is an integer within the range [−1..N-1];
it will always be possible to construct the list and its length will be finite.

I read this question and still don't understand why the order of list in that way. Would you please explain? Could not post a photo here to make it easier to understand. Thank you so much!

🌐
Studytonight
studytonight.com › python-howtos › how-to-declare-an-array-in-python
How to declare an array in Python - Studytonight
The below code example has an empty array. It is initialized with 5 elements carrying a default value (0). ... Array does not exist as a built-in data structure in Python. However, Python provides a array module to declare a set of data that acts as as an array.