Skip to content
Related Articles

Related Articles

Improve Article

Python List append() Method

  • Last Updated : 04 Aug, 2021
Geek Week

The Python List append() method is used for appending and adding elements to the end of the List

Syntax: list.append(item)

Parameters:

  • item: an item to be added at the end of the list

Returns:

The method doesn’t return any value 



Example 1: Adding an Item to the List

Python




# my_list
my_list = ['geeks', 'for']
  
# Add 'geeks' to the list
my_list.append('geeks')
  
print my_list

Output:

['geeks', 'for', 'geeks']

Example 2: Adding List to the List

Python




# my_list
my_list = ['geeks', 'for', 'geeks']
  
# another list
another_list = [6, 0, 4, 1]
  
# append another_list to my_list
my_list.append(another_list)
  
print my_list

Output:

['geeks', 'for', 'geeks', [6, 0, 4, 1]]

Note: A list is an object. If you append another list onto a list, the parameter list will be a single object at the end of the list.

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :