List Copy

Lists can contain any type of variable, and they can contain as many variables as you wish. Lists can also be iterated over in a very simple manner.

Lists are one of 4 built-in data types in Python used to store collections of data, the other 3 are Tuple, Set, and Dictionary, all with different qualities and usage. Lists are created using square brackets.

Example:

thislist = [“apple”, “banana”, “cherry”]
print(thislist)

Output:

[‘apple’, ‘banana’, ‘cherry’]

List items are ordered, changeable, and allow duplicate values.

List items are indexed, the first item has index [0], the second item has index [1] etc.

A List is a heterogeneous collection of elements separated by a comma. The number of elements in the list can be obtained using the len( ) function.

Example:

thislist = [“apple”, “banana”, “cherry”]
print(len(thislist))

Output:

3