How To Add an Item to a List in Python?

Last updated on February 2, 2023

To add an item into a list you can use the append() method that pushes the item into the list. It has one required parameter which can be a string, a number or an object.

Example 1

Let’s suppose we have a car list that contains three items that are stored into the favoriteList variable and we need to add one more into it.

favoriteList = ["BMW", "Ferrari", "Rose Royce"]

To add the new item into the favoriteList variable we need to attach the append() method with the variable and pass the string that needs to be added in the list.


To check if a string is added to the list we can use the print() function for printing the favoriteList variables data.

# Output: ['BMW', 'Ferrari', 'Rose Royce', 'Tesla']

In the output we got all the items along with a new one.

Example 2

In the second example let’s create a points list that contains integer values and store it points variable.

points = [10, 1, 100]

It has three items and we need to add one more to it. So attach the append() method to the points variable and pass the new item into append method as an argument.


Next we need to check if the new item is added.

# Output: [10, 1, 100, 50]

In the output, we get the list along with the new item.

Written by
I am a skilled full-stack developer with extensive experience in creating and deploying large and small-scale applications. My expertise spans front-end and back-end technologies, along with database management and server-side programming.

Share on:

Related Posts

Tags: Python, String,