---
description: The append function in Python helps insert new elements into a base list. The items are appended on the right-hand side of the existing list.
title: Python List Append() with Examples
image: https://www.guru99.com/images/python-list-append-1.png
---

 

[Skip to content](#main) 

**⚡ Smart Summary**

Python list append() adds a single object to the end of an existing list, increasing its length by one. The method modifies the list in place, returns no value, and accepts integers, strings, floats, or other objects.

* 🔘 **Syntax:** append() takes one argument and inserts it at the right-hand end of the base list.
* ☑️ **Return value:** append() changes the list in place and returns None, not a new list.
* ✅ **Building lists:** A for loop with append() or a list comprehension fills a list from scratch.
* 🧪 **Stack behavior:** append() acts as a push, while pop() removes the last item (last-in-first-out).
* 🛠️ **append vs extend:** append() adds one object; extend() adds every element of an iterable such as a tuple.
* 🤖 **AI workflows:** Machine learning loops use append() to collect features, predictions, and samples during training.

[ Read More ](javascript:void%280%29;) 

![Python List append\(\)](https://www.guru99.com/images/python-list-append-1.png)

## What is the Append method in Python?

The append function in Python helps insert new elements into a base list. The items are appended on the right-hand side of the existing list. The append method accepts a single argument and increments the size of the list by 1.

The following diagram illustrates Python’s append function:

[](https://www.guru99.com/images/3/python-list-append-1.png)

**Syntax:**

List.append(object)

**Note:** Here, the object could be an integer number, string, or floating number. An append function does not return any value or list. Instead, it modifies and grows the base list.

## How to utilize the Append function to create a Python list?

A Python list can be created and populated using two methods.

1. In the first method, list comprehension is used.
2. The second method utilizes the Append function and a “[for loop](https://www.guru99.com/python-loops-while-for-break-continue-enumerate.html)”. In this approach, you can create a user-defined function that uses for loops and appends.

Take a look at the example below that uses the second method:

import math
def calc_sqr_root(b_list):
    bop=[]
    for number in b_list:
        bop.append(math.sqrt(number))
    return bop
    
base_list=(4,9,100,25,36,49,81)
print("the Squared number list is as follows",base_list)
calc_sqr_root(base_list)
print("the numbers with square root in list is as follows",calc_sqr_root(base_list))

**Output:**

the Squared number list is as follows (4, 9, 100, 25, 36, 49, 81)
the numbers with square root in the list is as follows [2.0, 3.0, 10.0, 5.0, 6.0, 7.0, 9.0]

**Code Explanation:**

* Make use of square brackets to define an empty list.
* The for loop and append function is used together under a user-defined define function.
* It fills an empty list from scratch.
* It inserts single items one by one by making use of for loop to insert items.
* The appended list is used to return value for the user-defined function.

Below is an example that uses the first method:

**Example:**

**Python code:**

import math
def calc_sqr_root(b_list):
    return [math.sqrt(number) for number in b_list]
base_list=(4,9,100,25,36,49,81)
print("the Squared number list is as follows",base_list)
calc_sqr_root(base_list)
print("the numbers with square root in list is as follows",calc_sqr_root(base_list))

**Output:**

the Squared number list is as follows (4, 9, 100, 25, 36, 49, 81)
the numbers with a square root in the list are as follows [2.0, 3.0, 10.0, 5.0, 6.0, 7.0, 9.0]

**Code Explanation:**

* You can use list comprehension as a substitute to append a function in Python to fill a list from scratch.
* It helps in populating a list from the start.
* The List comprehension under the customized list helps populate elements in the original list.
* It helps optimize the processing of data compared to the combination of for loop with the append function.

## How Append method Works?

The append function works in the following manner:

* The Append function in Python adds the object to the base list.
* It takes the object as an argument and places it in the next empty space.
* The list items are ordered and can be accessed using the index.

Below is an image showing the indexes for the elements:

[](https://www.guru99.com/images/3/python-list-append-2.png)

Let us take the below example that adds elements to the base list.

**Python Example:**

baselist = ['P','Y','3','4.2','T']
print("The original list", baselist)
print("At index 0:", baselist[0])
print("At index 3:",baselist[3])
baselist.append('n')
print("The appended list", baselist)
print("At index 5 post append:",baselist[5])

**Output:**

The original list ['P', 'Y', '3', '4.2', 'T']
At index 0: P
At index 3: 4.2
The appended list ['P', 'Y', '3', '4.2', 'T', 'n']
At index 5 post append: n

**Code Explanation:**

* The Append function added object data type of object to the reserved space available in the list.
* Python lists are iterable sequences that can hold different data types and objects.

The append function adds a new element at index 5, as shown below:

[](https://www.guru99.com/images/3/python-list-append-3.png)

### RELATED ARTICLES

* [Python Exception Handling: try, except, finally, raise ](https://www.guru99.com/python-exception-handling.html "Python Exception Handling: try, except, finally, raise")
* [Python vs Ruby – Difference Between Them ](https://www.guru99.com/python-vs-ruby-difference.html "Python vs Ruby – Difference Between Them")
* [Python Array – Define, Create ](https://www.guru99.com/python-arrays.html "Python Array – Define, Create")
* [Python break, continue, pass statements with Examples ](https://www.guru99.com/python-break-continue-pass.html "Python break, continue, pass statements with Examples")

## How to insert elements to a list without Append?

Programmers can add elements to a list by applying a two-step process if the append function is not used.

Using a Len function, you can find out the length of the last item in a list. Assign the empty space identified to the new object. The following example illustrates the concept:

**Example:**

base_list=[2,4,6]
print("The list before append",base_list)
base_list[len(base_list):]=[10]
print("The list after append",base_list)

**Output:**

The list before append [2, 4, 6]
The list after append [2, 4, 6, 10]

## How to define Stack using Append Function?

The following attributes apply to a stack:

* A stack can be defined as a data structure that places items one over another.
* The items can be inserted or deleted on last in first out basis.
* Typically, a stack pushes an item either at the end or at the top of the stack, whereas a pop operation removes an item from the stack.
* An append function acts as a push operation of the stack, whereas a list, by default, has a pop function defined for removing items.
* The pop method, by default, returns and removes the last item from the list when no arguments are specified to the function.
* It throws an index error when the list becomes empty.
* If an integer argument is provided to the function, then it returns the index of the list.
* It removes the item present at that index of the list.

Let us look at a program where the append and pop function work as push and pop operations for the defined stack:

**Example:**

**Python code:**

#initialize the stack
GGGstack = []
print("Adding item to the list",GGGstack.append(100))
print("Adding item to the list",GGGstack.append(2333))
print("Adding item to the list",GGGstack.append(50000))
print("the base list after adding elements,",GGGstack)
print("base list after calling pop",GGGstack.pop())
print("base list after calling pop",GGGstack.pop())
print("base list after calling pop",GGGstack.pop())
print("base list after calling pop",GGGstack.pop())

**Output:**

Adding item to the list None

Adding item to the list None

Adding item to the list None

the base list after adding elements, Stack([100, 2333, 50000])

base list after calling pop 50000

base list after calling pop 2333

base list after calling pop 100

Empty stack

base list after calling pop None

**Code Explanation:**

* A stack GGGStack is defined
* Items are added using the append method
* Each item is popped from the original list one by one.
* When the list is empty, it throws an index error.

## What is the extend method in Python?

Extend function allows adding new elements to an iterable list. Examples of iterable lists include dictionaries, tuples, and strings. These attributes help you modify the elements of an iterable list.

**Note:** This function does not return any value post its execution.

The following is the syntax for the extend function:

**Syntax:**

List.extend(iterable list)

## Difference between Extend and Append in Python

The append and extend methods differ in the following key ways:

* The append function in Python adds only one element to the original list, while the extend function allows multiple items to be added.
* The append list takes only a single argument, whereas the extend function takes an iterable list such as tuples and dictionaries.

## FAQs

🔢 What is the difference between append() and insert() in a Python list?

append() adds one object to the end of a list. insert() places an element at a chosen index and shifts later items right, so use it only when position matters.

⏱️ What is the time complexity of the Python list append() method?

Appending runs in amortized O(1) time. Python occasionally resizes the array and copies every element at O(n) cost, but that is rare, so the average per-append cost stays constant.

🔄 What does the Python list append() method return?

The append() method returns None because it edits the list in place. Writing new = old.append(x) stores None and loses the list, a frequent beginner mistake worth avoiding.

🧱 What happens when you append one list to another list?

Passing a list to append() adds it as one nested element, so \[1, 2\].append(\[3, 4\]) gives \[1, 2, \[3, 4\]\]. Use extend() or the plus operator to merge the elements individually.

⚡ Is append() faster than the plus operator for building a list?

Yes. Repeated append() calls reuse pre-allocated space and stay near constant time, while the plus operator rebuilds the whole list on each step, making append() far faster inside loops.

🧵 Is the Python list append() method thread-safe?

In CPython, the Global Interpreter Lock makes a single append() call atomic, so appending to a shared list from several threads will not corrupt it. Multi-step sequences still need an explicit lock.

🤖 How is the list append() method used in AI and machine learning?

Machine learning code uses append() to gather features, predictions, and batch samples inside loops before converting them into NumPy arrays or tensors for AI training pipelines.

✨ Can GitHub Copilot or agentic AI tools generate list append() code?

Yes. GitHub Copilot and agentic AI assistants generate append() calls, loops, and comprehensions from a short comment, and can refactor repeated append() statements into one comprehension. Still test the output.

#### Summarize this post with:

ChatGPT Perplexity Grok Google AI 

**Stay Updated on AI** **Get Weekly AI Skills, Trends, Actionable Advice.** 

##### Sign up for the newsletter

Subscribe for Free 

You have successfully subscribed.  
Please check your inbox. 

![AI-Newsletter]() Chosen by over **350,000+** professionals 

[Scroll to top ](#wrapper)Scroll to top 

× 

Toggle Menu Close 

Search for: 

Search

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.guru99.com/#organization","name":"Guru99","sameAs":["https://www.facebook.com/Guru99Official","https://twitter.com/guru99com"],"logo":{"@type":"ImageObject","@id":"https://www.guru99.com/#logo","url":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","contentUrl":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","caption":"Guru99","inLanguage":"en-US"}},{"@type":"WebSite","@id":"https://www.guru99.com/#website","url":"https://www.guru99.com","name":"Guru99","publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https://www.guru99.com/images/python-list-append-1.png","url":"https://www.guru99.com/images/python-list-append-1.png","width":"700","height":"250","caption":"Python List append()","inLanguage":"en-US"},{"@type":"BreadcrumbList","@id":"https://www.guru99.com/python-list-append.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":"1","item":{"@id":"https://www.guru99.com","name":"Home"}},{"@type":"ListItem","position":"2","item":{"@id":"https://www.guru99.com/python","name":"Python"}},{"@type":"ListItem","position":"3","item":{"@id":"https://www.guru99.com/python-list-append.html","name":"Python List Append() with Examples"}}]},{"@type":"WebPage","@id":"https://www.guru99.com/python-list-append.html#webpage","url":"https://www.guru99.com/python-list-append.html","name":"Python List Append() with Examples","dateModified":"2026-07-11T11:15:21+05:30","isPartOf":{"@id":"https://www.guru99.com/#website"},"primaryImageOfPage":{"@id":"https://www.guru99.com/images/python-list-append-1.png"},"inLanguage":"en-US","breadcrumb":{"@id":"https://www.guru99.com/python-list-append.html#breadcrumb"}},{"@type":"Person","@id":"https://www.guru99.com/author/anna","name":"Anna Blake","description":"I'm Anna Blake, specializing in Python tutorials, offering clear and concise lessons to help you master Python programming efficiently.","url":"https://www.guru99.com/author/anna","image":{"@type":"ImageObject","@id":"https://www.guru99.com/images/anna-blake-author.png","url":"https://www.guru99.com/images/anna-blake-author.png","caption":"Anna Blake","inLanguage":"en-US"},"worksFor":{"@id":"https://www.guru99.com/#organization"}},{"articleSection":"Python","headline":"Python List Append() with Examples","description":"The append function in Python helps insert new elements into a base list. The items are appended on the right-hand side of the existing list.","keywords":"python","speakable":{"@type":"SpeakableSpecification","cssSelector":[".entry-title",".summary"]},"@type":"Article","author":{"@id":"https://www.guru99.com/author/anna","name":"Anna Blake"},"dateModified":"2026-07-11T11:15:21+05:30","image":{"@id":"https://www.guru99.com/images/python-list-append-1.png"},"copyrightYear":"2026","name":"Python List Append() with Examples","subjectOf":[{"@type":"FAQPage","mainEntity":[{"@type":"Question","name":"What is the difference between append() and insert() in a Python list?","acceptedAnswer":{"@type":"Answer","text":"append() adds one object to the end of a list. insert() places an element at a chosen index and shifts later items right, so use it only when position matters."}},{"@type":"Question","name":"What is the time complexity of the Python list append() method?","acceptedAnswer":{"@type":"Answer","text":"Appending runs in amortized O(1) time. Python occasionally resizes the array and copies every element at O(n) cost, but that is rare, so the average per-append cost stays constant."}},{"@type":"Question","name":"What does the Python list append() method return?","acceptedAnswer":{"@type":"Answer","text":"The append() method returns None because it edits the list in place. Writing new = old.append(x) stores None and loses the list, a frequent beginner mistake worth avoiding."}},{"@type":"Question","name":"What happens when you append one list to another list?","acceptedAnswer":{"@type":"Answer","text":"Passing a list to append() adds it as one nested element, so [1, 2].append([3, 4]) gives [1, 2, [3, 4]]. Use extend() or the plus operator to merge the elements individually."}},{"@type":"Question","name":"Is append() faster than the plus operator for building a list?","acceptedAnswer":{"@type":"Answer","text":"Yes. Repeated append() calls reuse pre-allocated space and stay near constant time, while the plus operator rebuilds the whole list on each step, making append() far faster inside loops."}},{"@type":"Question","name":"Is the Python list append() method thread-safe?","acceptedAnswer":{"@type":"Answer","text":"In CPython, the Global Interpreter Lock makes a single append() call atomic, so appending to a shared list from several threads will not corrupt it. Multi-step sequences still need an explicit lock."}},{"@type":"Question","name":"How is the list append() method used in AI and machine learning?","acceptedAnswer":{"@type":"Answer","text":"Machine learning code uses append() to gather features, predictions, and batch samples inside loops before converting them into NumPy arrays or tensors for AI training pipelines."}},{"@type":"Question","name":"Can GitHub Copilot or agentic AI tools generate list append() code?","acceptedAnswer":{"@type":"Answer","text":"Yes. GitHub Copilot and agentic AI assistants generate append() calls, loops, and comprehensions from a short comment, and can refactor repeated append() statements into one comprehension. Still test the output."}}]}],"@id":"https://www.guru99.com/python-list-append.html#schema-1140716","isPartOf":{"@id":"https://www.guru99.com/python-list-append.html#webpage"},"publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US","mainEntityOfPage":{"@id":"https://www.guru99.com/python-list-append.html#webpage"}}]}
```
