List
List
Mutable, list can be modified
List needs to be in square bracket [], for example: [1,2,3,4,5] or [βaβ,βbβ,βcβ] or [1,2,3,βaβ,βbβ,β10β]
List is a sequence, iterable
l=[βaβ,βbβ,βcβ]
l[0]=βaβ
l[1]=βbβ
l[2]=βcβ
It is zero based indexing, index starts from zero
List can be iterated through:
for i in l:
print(i)Convert to List, use function list()
For example:
n=12345
list(n) becomes [1,2,3,4,5]
List is an object, meaning it has methods and attributes that can be invoked
To see all methods, type
help(<list variable>)
In Jupyter notebook, to see list of methods or attributes
Press shift key after enter <list variable>.

Fibonacci series:
the sum of two elements defines the next
running it will display:
Last updated
Was this helpful?