Lecture3 Py
Lecture3 Py
95]
List
Methods
list = [2, 1,
3]
list.append(4)#adds one element at [2, 1, 3,
the end 4]
list.sort( )#sorts in ascending order [1, 2, 3]
list [3, 1, 2]
tup1 = ( )
tup2 = ( 1, )
tup3 = ( 1, 2,
3)
Tuple
Methods
tup = (2, 1, 3, 1)
tup.index( el ) #returns
index of first occurrence tup.index(1) is
1