// Tutorial //

How To add Elements to a List in Python

Published on August 3, 2022 · Updated on September 20, 2022
Default avatar

By Pankaj

How To add Elements to a List in Python


In this tutorial, we will learn different ways to add elements to a list in Python.

There are four methods to add elements to a List in Python.

  1. append(): append the element to the end of the list.
  2. insert(): inserts the element before the given index.
  3. extend(): extends the list by appending elements from the iterable.
  4. List Concatenation: We can use the + operator to concatenate multiple lists and create a new list.


In order to complete this tutorial, you will need:

This tutorial was tested with Python 3.9.6.


This function adds a single element to the end of the list.

fruit_list = ["Apple", "Banana"]

print(f'Current Fruits List {fruit_list}')

new_fruit = input("Please enter a fruit name:\n")


print(f'Updated Fruits List {fruit_list}')


Current Fruits List ['Apple', 'Banana']
Please enter a fruit name:
Updated Fruits List ['Apple', 'Banana', 'Orange']

This example added Orange to the end of the list.


This function adds an element at the given index of the list.

num_list = [1, 2, 3, 4, 5]

print(f'Current Numbers List {num_list}')

num = int(input("Please enter a number to add to list:\n"))

index = int(input(f'Please enter the index between 0 and {len(num_list) - 1} to add the number:\n'))

num_list.insert(index, num)

print(f'Updated Numbers List {num_list}')


Current Numbers List [1, 2, 3, 4, 5]
Please enter a number to add to list:
Please enter the index between 0 and 4 to add the number:
Updated Numbers List [1, 2, 20, 3, 4, 5]

This example added 20 at the index of 2. 20 has been inserted into the list at this index.


This function adds iterable elements to the list.

extend_list = []

extend_list.extend([1, 2])  # extending list elements


extend_list.extend((3, 4))  # extending tuple elements


extend_list.extend("ABC")  # extending string elements



[1, 2]
[1, 2, 3, 4]
[1, 2, 3, 4, 'A', 'B', 'C']

This example added a list of [1, 2]. Then it added a tuple of (3, 4). And then it added a string of ABC.

List Concatenation

If you have to concatenate multiple lists, you can use the + operator. This will create a new list, and the original lists will remain unchanged.

evens = [2, 4, 6]
odds = [1, 3, 5]

nums = odds + evens

print(nums)  # [1, 3, 5, 2, 4, 6]

This example added the list of evens to the end of the list of odds. The new list will contain elements from the list from left to right. It’s similar to the string concatenation in Python.


Python provides multiple ways to add elements to a list. We can append an element at the end of the list, and insert an element at the given index. We can also add a list to another list. If you want to concatenate multiple lists, then use the overloaded + operator


Want to deploy your application quickly? Try Cloudways, the #1 managed hosting provider for small-to-medium businesses, agencies, and developers - for free. DigitalOcean and Cloudways together will give you a reliable, scalable, and hassle-free managed hosting experience with anytime support that makes all your hosting worries a thing of the past. Start with $100 in free credits!

Learn more here

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in our Questions & Answers section, find tutorials and tools that will help you grow as a developer and scale your project or business, and subscribe to topics of interest.

Sign up now
About the authors
Default avatar


Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
DigitalOcean Employee
DigitalOcean Employee badge
December 6, 2020

list1 = [“M”, “na”, “i”, “Ke”] list2 = [“y”, “me”, “s”, “lly”] list3 = [i + j for i,j in zip(list1, list2)] How is the above different to this; list3 = list() for i,j in zip(list1, list2): list3 = i + j how are these 2 codes different from one another?

- Asad Jaffer

    DigitalOcean Employee
    DigitalOcean Employee badge
    November 23, 2020

    how to use add method like i mean list.add(x)… explain

    - Abdul

      DigitalOcean Employee
      DigitalOcean Employee badge
      August 18, 2020

      new_list=elements[::2] #explain this

      - Varada

        DigitalOcean Employee
        DigitalOcean Employee badge
        April 23, 2020

        is there anything like list.add(num)

        - harshita

          Try DigitalOcean for free

          Click here to sign up and get $200 of credit to try our products over 60 days!
          Try DigitalOcean for free