Append Elements to Empty List in Python Last Updated : 10 Dec, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report In Python, lists are used to store multiple items in one variable. If we have an empty list and we want to add elements to it, we can do that in a few simple ways. The simplest way to add an item in empty list is by using the append() method. This method adds a single element to the end of the list. Python a = [] # Append an element to the list a.append(10) print(a) Output[10] Other methods that we can use to append elements to a list are:Table of ContentUsing the + Operator to Concatenate ListsUsing the extend() MethodUsing List UnpackingUsing + Operator to Concatenate ListsAnother way to add elements to an empty list is by using the + operator. We can concatenate the original list with another list containing the element we want to add. Python # Create an empty list a = [] # Concatenate the list with a new list containing the element a = a + [20] print(a) Output[20] Using extend() MethodThe extend() method allows us to add multiple elements to a list. We can use it if we want to add more than one item at a time. Python a = [] # Extend the list by adding multiple elements a.extend([30, 40, 50]) print(a) Output[30, 40, 50] Using List UnpackingList unpacking is a more advanced method but it’s still a great option to add elements to a list. Python a = [] #Use list unpacking to add an element a = [*a, 60] print(a) Output[60] Comment More infoAdvertise with us Next Article Extract Elements from a Python List P prashanth_santhanaraman Follow Improve Article Tags : Python Python Programs python-list Practice Tags : pythonpython-list Similar Reads Remove elements at Indices in List - Python In Python, lists store items in a specific order and each item has an index. Removing elements by index means creating a new list that excludes items at certain positions. This helps in keeping only the needed elements while discarding others based on their index. For example:Input : li= [5, 6, 3, 7 2 min read Extract Elements from a Python List When working with lists in Python, we often need to extract specific elements. The easiest way to extract an element from a list is by using its index. Python uses zero-based indexing, meaning the first element is at index 0. Pythonx = [10, 20, 30, 40, 50] # Extracts the last element a = x[0] print( 2 min read Get the Last Element of List in Python In this article, we will learn about different ways of getting the last element of a list in Python. For example, consider a list:Input: list = [1, 3, 34, 12, 6]Output: 6Explanation: Last element of the list l in the above example is 6.Let's explore various methods of doing it in Python:1. Using Neg 2 min read Python | Remove trailing empty elements from given list When working with lists in Python, it's common to encounter lists with extra None elements at the end. These trailing None values can cause issues in our programs . We can remove these trailing None elements using simple methods like slicing, loops, or filter.Using List Slicing Slicing is a very eff 3 min read Appending Element into a List in Python Dictionary We are given a dictionary where the values are lists and our task is to append an element to a specific list. For example: d = {"a": [1, 2], "b": [3, 4]} and we are appending 5 to key "a" then the output will be {'a': [1, 2, 5], 'b': [3, 4]}Using append()This is the simplest and most direct way to a 3 min read Remove Elements From a List Based on Condition in Python In Python, lists are a versatile and widely used data structure. There are often situations where you need to remove elements from a list based on a specific condition. In this article, we will explore five simple and commonly used methods to achieve this task. Remove Elements From A List Based On A 3 min read Like