Common List Operations

Explore some of the properties and utilities that come in-built with the list data structure.

Adding elements

All the elements of a list cannot always be specified beforehand and there’s a strong possibility that we’ll want to add more elements during runtime.

The append() method can be used to add a new element at the end of a list. The following template must be followed:

a_list.append(newElement)

Here’s an example:

Get hands-on with 1400+ tech skills courses.