Python ProgrammingPython Programming

How to add an item to the end of the list in python?

The append() method used to append an item at the end of list.

"Africa" added at the end of list:

testList = ["Canada", "Japan", "London", "Germany"]
print(testList)
 
testList.append("Africa")
print(testList)
Output
['Canada', 'Japan', 'London', 'Germany']
['Canada', 'Japan', 'London', 'Germany', 'Africa']