{"id":3678,"date":"2023-10-23T19:28:52","date_gmt":"2023-10-23T13:58:52","guid":{"rendered":"https:\/\/python-programs.com\/?p=3678"},"modified":"2023-11-10T11:55:27","modified_gmt":"2023-11-10T06:25:27","slug":"python-how-to-add-an-element-in-list-append-vs-extend","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-how-to-add-an-element-in-list-append-vs-extend\/","title":{"rendered":"Python : How to Add an Element in List ? | append() vs extend()"},"content":{"rendered":"

A collection is an ordered list of values. There could be various types of values. A list is a mutable container. This means that existing ones can be added to, deleted from, or changed.<\/p>\n

The Python list represents the mathematical concept of a finite sequence. List values are referred to as list items or list elements. The same value may appear multiple times in a list. Each event is regarded as a distinct element.<\/p>\n

Given a list, the task is to add the elements to the givenlist using append and extend methods<\/p>\n

Adding element to the list<\/h2>\n

We can add elements to list by several methods some of them are:<\/p>\n