Lists in Python

Array or List in Python is a useful data structure to store and access data.

A list is defined as below:

mylist = []

An item is added to the list as below:


We can get the length of the list using len:

list_len = len(myList)

To loop through the entire using a for loop:

for x in mylist:

Delete an item from a list using del

del mylist[0]