You can append the elements of one list to another with the "+=" operator. Note that the "+" operator creates a new list.
a = [1, 2, 3]
b = [10, 20]
a = a + b # Create a new list a+b and assign back to a.
print a
# [1, 2, 3, 10, 20]
# Equivalently:
a = [1, 2, 3]
b = [10, 20]
a += b
print a
# [1, 2, 3, 10, 20]
If you want to append the lists and keep them as lists, then try:
result = []
result.append(a)
result.append(b)
print result
# [[1, 2, 3], [10, 20]]
Answer from stackoverflowuser2010 on Stack OverflowEducative
educative.io › answers › how-to-add-one-array-to-another-array-in-python
How to add one array to another array in Python
In Python, adding one array to another is straightforward. The numpy.add() function and the + operator both perform element-wise addition efficiently. NumPy is ideal for handling numerical data, offering speed and convenience.
Top answer 1 of 4
149
You can append the elements of one list to another with the "+=" operator. Note that the "+" operator creates a new list.
a = [1, 2, 3]
b = [10, 20]
a = a + b # Create a new list a+b and assign back to a.
print a
# [1, 2, 3, 10, 20]
# Equivalently:
a = [1, 2, 3]
b = [10, 20]
a += b
print a
# [1, 2, 3, 10, 20]
If you want to append the lists and keep them as lists, then try:
result = []
result.append(a)
result.append(b)
print result
# [[1, 2, 3], [10, 20]]
2 of 4
61
Apart from + operator there's another way to do the same i.e. extend()
a = [1, 2, 3]
b = [10, 20]
a.append(b) # Output: [1, 2, 3, [10, 20]]
a.extend(b) # Output: [1, 2, 3, 10, 20]
You can use these 2 functions for manipulating a list as per your requirement.
Videos
04:00
python append array to another array - YouTube
03:42
✅ How To Append An Array To An Array In Python 🔴 - YouTube
05:00
Append Values to NumPy Arrays | Master NumPy Array Appending: Append, ...
03:21
Python Intro Ep 07 - Appending to Arrays - YouTube
00:14
How Do You Append To An Array in Python? [GCSE COMPUTER SCIENCE] ...
01:00
Append to Numpy Array - np.append() #numpy #python #datascience ...
DigitalOcean
digitalocean.com › community › tutorials › python-add-to-array
Python Array Add: How to Append, Extend & Insert Elements | DigitalOcean
April 15, 2025 - Learn how to add elements to an array in Python using append(), extend(), insert(), and NumPy functions. Compare performance and avoid common errors.
Python documentation
docs.python.org › 3 › library › stdtypes.html
Built-in Types — Python 3.14.3 documentation
4 days ago - If k is not equal to 1, t must have the same length as the slice it is replacing. The value n is an integer, or an object implementing __index__(). Zero and negative values of n clear the sequence. Items in the sequence are not copied; they are referenced multiple times, as explained for s * n under Common Sequence Operations. ... Append value to the end of the sequence This is equivalent to writing seq[len(seq):len(seq)] = [value].
W3Schools
w3schools.com › python › numpy › numpy_array_join.asp
NumPy Joining Array
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING INTRO TO HTML & CSS BASH RUST · NumPy HOME NumPy Intro NumPy Getting Started NumPy Creating Arrays NumPy Array Indexing NumPy Array Slicing NumPy Data Types NumPy Copy vs View NumPy Array Shape NumPy Array Reshape NumPy Array Iterating NumPy Array Join NumPy Array Split NumPy Array Search NumPy Array Sort NumPy Array Filter
Python
docs.python.org › 3 › library › itertools.html
itertools — Functions creating iterators for efficient looping
5 days ago - def zip_longest(*iterables, fillvalue=None): # zip_longest('ABCD', 'xy', fillvalue='-') → Ax By C- D- iterators = list(map(iter, iterables)) num_active = len(iterators) if not num_active: return while True: values = [] for i, iterator in enumerate(iterators): try: value = next(iterator) except StopIteration: num_active -= 1 if not num_active: return iterators[i] = repeat(fillvalue) value = fillvalue values.append(value) yield tuple(values) If one of the iterables is potentially infinite, then the zip_longest() function should be wrapped with something that limits the number of calls (for example islice() or takewhile()). This section shows recipes for creating an extended toolset using the existing itertools as building blocks.
NumPy
numpy.org › doc › 2.3 › reference › generated › numpy.append.html
numpy.append — NumPy v2.3 Manual
>>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
Google
developers.google.com › google for education › python › python lists
Python Lists | Python Education | Google for Developers
January 23, 2026 - Python's built-in list type is defined using square brackets [ ] and elements are accessed using zero-based indexing. Assigning one list variable to another makes both variables point to the same list in memory. The for and in constructs are used to iterate over list elements or check for element presence. The range() function is often used with a for-loop to create a traditional numeric loop. Various list methods like append(), insert(), extend(), index(), remove(), sort(), reverse(), and pop() are available to modify and interact with lists.
W3Schools
w3schools.com › python › python_arrays.asp
Python Arrays
You can use the append() method to add an element to an array. ... You can use the pop() method to remove an element from the array. ... You can also use the remove() method to remove an element from the array.
DigitalOcean
digitalocean.com › community › tutorials › numpy-append-in-python
numpy.append() in Python | DigitalOcean
August 3, 2022 - Python numpy append() function is used to merge two arrays.
Reddit
reddit.com › r/learnpython › do you guys know how to add append an array in a 2d array?
r/learnpython on Reddit: do you guys know how to add append an array in a 2d array?
February 19, 2024 -
say i have array [[1,2,3,4,5]], how can i duplicate it 5 times to [[1,2,3,4,5],[1,2,3,4,5],[1,2,3,4,5],[1,2,3,4,5],[1,2,3,4,5]] ?
Top answer 1 of 4
1
Easy way: x = your_list[0] for i in range(len(5)): your_list.append(x) Might be a more optimized way to do it but at least it should work
2 of 4
1
y=x*5 will give you a pointer to the same OG list. It’s generally not what you want, but if you’re going to numpy, it’s fine. Otherwise, why not x.append([1,2,3,4,5]) and stick it in a for loop. You seem like you know, but are looking for a slick way to do it and there really isn’t.
TutorialsPoint
tutorialspoint.com › python-program-to-push-an-array-into-another-array
Python Program to push an array into another array
May 29, 2023 - The indexing in python starts from 0, so that the above array elements are accessed using their respective index values 0, 1, 2, 3, 4. Pushing an array into another array means, inserting all elements present in array_1 into the array array_2. So that the elements of array_1 will be added at the end of array_2. Assume we have two arrays A and B with integer values. And the resultant array will have inserted elements of array B into the array A.