Append to Array in Python

In Python, lists can be used as arrays, because the language doesn’t have built-in support.

An array is one chunk of memory that usually consists of multiple elements, whereas a list is a list of objects where one element points to another and it doesn’t have to be inside one block of memory.

You can simulate an array by changing an element with the index number.


['A', 'X', 'Y', 'Z', 'E']

Append an element to an array

To add a new element to an array, use the append function.


['A', 'B', 'C', 'D', 'E', 'X', 'Y', 'Z']