= [1,2,3]
x type(x)
list
The list is the basic type of “container” object in Python:
= [1,2,3]
x type(x)
list
= ["a", "b", "c"]
y type(y)
list
= [True, False, False, True]
z type(z)
list
We can access list elements using square brackets. Note that the first entry is indexed at 0:
1] y[
'b'
0] y[
'a'
A Python list does not have to have elements all of one type:
= [True, 0, "whatever",[1,2]]
v type(v[2])
%timeit sum(x)
37.7 ns ± 0.0464 ns per loop (mean ± std. dev. of 7 runs, 10,000,000 loops each)