The list.append() function is used to add an element to the current list. Sometimes, list.append() not working in Python because it is a manipulation and does not return any values. Let’s see how to use the list.append() function properly.
Why List.append() Not Working In Python?
The primary reason that makes list.append() not working in Python is that you try to print out this function. But, the list.append() function is used to add an element to the current list. It is a manipulation and does not return any values. So, when you print out this function, the result will be None.
Look at the example below.
# Create a list. animals = ['Dog', 'Duck', 'Pig', 'Cat', 'Lion', 'Tiger', 'Shark', 'Fish'] # Add 'Rabbit' to the list. print(animals.append('Rabbit'))
Output
None
Use the list.append() function properly
As we mentioned above, the primary reason that makes list.append() not working in Python is that you try to print out this function. So, you should manipulate this function and prevent it from printing.
Append a value to the list
You can append a value to the current list with the append() function. Simply, you assign the desired value inside the parentheses. You will need to assign any other parameters.
Look at the example below.
# Create a list. animals = ['Dog', 'Duck', 'Pig', 'Cat', 'Lion', 'Tiger', 'Shark', 'Fish'] print(animals) # Add 'Rabbit' to the list. animals.append('Rabbit') print(animals)
Output
['Dog', 'Duck', 'Pig', 'Cat', 'Lion', 'Tiger', 'Shark', 'Fish']
['Dog', 'Duck', 'Pig', 'Cat', 'Lion', 'Tiger', 'Shark', 'Fish', 'Rabbit']
To append multiple values, you have to use the list.append() function n times with n as the number of values.
Append a list to the current list
Besides, to append a list to the current list, you can use list, you can use a list.append() function combined with the list comprehension or for loop. For simplicity, we will use the for loop for this example.
Look at the example below.
# Create a list. animals = ['Dog', 'Duck', 'Pig', 'Cat', 'Lion', 'Tiger', 'Shark', 'Fish'] print(animals) # A list to be added. my_list = ['Rabbit', 'Turtle', 'Butterfly'] # Add this list to the first list with the list.append() function. for animal in my_list: animals.append(animal) print(animals)
Output
['Dog', 'Duck', 'Pig', 'Cat', 'Lion', 'Tiger', 'Shark', 'Fish']
['Dog', 'Duck', 'Pig', 'Cat', 'Lion', 'Tiger', 'Shark', 'Fish', 'Rabbit', 'Turtle', 'Butterfly']
Using the ‘+’ operator to add a list to the initial list.
You can add a list to the initial list with the list.append() function combined with the for loop. But you will not get high performance if you do that. Another way, you can use the ‘+’ operator to add a list to the initial list.
Look at the example below.
# Create a list. animals = ['Dog', 'Duck', 'Pig', 'Cat', 'Lion', 'Tiger', 'Shark', 'Fish'] print(animals) # A list to be added. my_list = ['Rabbit', 'Turtle', 'Butterfly'] # Add this list to the first list with the '+' operator. animals += my_list print(animals)
Output
['Dog', 'Duck', 'Pig', 'Cat', 'Lion', 'Tiger', 'Shark', 'Fish']
['Dog', 'Duck', 'Pig', 'Cat', 'Lion', 'Tiger', 'Shark', 'Fish', 'Rabbit', 'Turtle', 'Butterfly']
Summary
We have shown you which case makes the list.append() not working in Python and how to use it properly. The primary reason that makes list.append() not working in Python is that you try to print out this function. So, you should manipulate this function and prevent it from printing. We hope this tutorial is helpful to you. Thanks!

My name is Thomas Valen. As a software developer, I am well-versed in programming languages. Don’t worry if you’re having trouble with the C, C++, Java, Python, JavaScript, or R programming languages. I’m here to assist you!
Name of the university: PTIT
Major: IT
Programming Languages: C, C++, Java, Python, JavaScript, R