python lists are very simple objects or array which store can multiple amount of data.
x = [7, 44, 3, 10]
These are ordered, changeable and allow duplicate values
Ordered
each of their items/elements have a specific position and can be identified by it. In the example above ‘1’ will be the 0th element, ‘2’ will be the 1st element and so on. so in order to get the 4 element , we can do
x = [7, 44, 3, 10]
print(x[3])
[7, 44, 3, 10]
10
Changeable
values can be added removed or changed in a list
x = ['ben', 2, 1, '90']
print(x)
x[1] = 100
print(x)
['ben', 2, 1, '90']
['ben', 100, 1, '90']
Duplicates
x = ['ben', 2, 1, '90']
x[2] = 2
print(x)
['ben', 2, 2, '90']
notice our list can have two ‘2’ inside it. this feature is not present in other kinds of data type like tuples and dictionaries
type() of python lists
x = ['apple', 'house', 'gun']
print(type(x))
<class 'list'>