Lists in Python

Lists • In Python lists are used to store multiple items in a single variable. • Lists are initialised within square brackets [ ]. • Lists are ordered,mutable (i.e can be changed) and allow duplicate values. Syntax to create list : mylist = [ 1,2,3, 'A','B' ] • We can also access elements in list by indexing : In : print (mylist[0]) Out : 1 • We can also change item values in list as : In : mylist[ 1 ] = ' C ' print (mylist) Out : [ 1,'C',3,'A','B' ] Common Functions performed on Lists are as follows : Examples on above functions are as follows :