You are on page 1of 1

PYTHON LISTS

• Lists are used to store multiple items in a single


variable.

• Lists are one of 4 built-in data types in Python used to


store collections of data.

• Lists are created using square brackets

• A list can have any number of items and they may be


of different types (integer, float, string, etc.).

• A list can also have another list as an item. This is


called a nested list.

• There are various ways in which we can access the


elements of a list.

• Python Lists are just like dynamically sized arrays,


declared in other languages (vector in C++ and
ArrayList in Java).

• A list may contain duplicate values with their distinct


positions and hence, multiple distinct or duplicate
values can be passed as a sequence at the time of list
creation.

• You can update single or multiple elements of lists by


giving the slice on the left-hand side of the
assignment operator, and you can add to elements in
a list with the append() method.

• To remove a list element, you can use either the del


statement if you know exactly which element(s) you
are deleting or the remove() method

You might also like