0% found this document useful (0 votes)
443 views

CH 6 List Manipulation Class 11

This document provides information on list manipulation in Python. It discusses creating and accessing lists, nested lists, creating lists from existing sequences, indexing and slicing lists, joining and replicating lists, comparing lists, list operations like updating and modifying lists, and using list methods and functions like len(), index(), and append(). Key points include that lists allow ordered collections of elements of any type, elements can be accessed by index and value, lists can be nested within other lists, and various methods exist for manipulating and working with lists in Python.

Uploaded by

Pappu Pass
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
443 views

CH 6 List Manipulation Class 11

This document provides information on list manipulation in Python. It discusses creating and accessing lists, nested lists, creating lists from existing sequences, indexing and slicing lists, joining and replicating lists, comparing lists, list operations like updating and modifying lists, and using list methods and functions like len(), index(), and append(). Key points include that lists allow ordered collections of elements of any type, elements can be accessed by index and value, lists can be nested within other lists, and various methods exist for manipulating and working with lists in Python.

Uploaded by

Pappu Pass
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

LIST MANIPOLATIDN

ke a Cen atae t n t a r t
CAeating /Accesuing itstoe aaeguowee iludo
depieted tto44 aquane bqacket
x: uta &Ce ecg elenme n co
21 n Cace no
ae congel
Co e n elalhe4f
C,11, 'a9 Tcle e .luol elemenls co
a ,2,a1 accesaeol by noe ualue,
aLo] valute.can be mued alala tyhe
-Cuat aAe a t o e r jus k e al.

*Caeating List - pul expaeskom RqUane bxachet


n
9bracket" inolieale etast aud Cnol ) &t
RepoAale ctena Oom.a
Cvat.val,J
EMPTY LIST: equivalett to o
Luilh value o fala.
Sm LListC)
Lt uRqemeale enupty Wt uth ngme L
LONC LIST covkadn man eloment
valueacan be eRacro neveral ines
L C 23,u, S,G,
8 , 9 , 10, 12
NESTED LIST:-ist dinsicle anothe List,
ExL Li,2,L&,üj,s]1
3

To accem inatcle st elemet LL2JCo] 3

CREATING LiST ROm ExISTINGSEQUENCE


Sn/p: L iat ('abcd')
/p tà, 'b''c'd
E =ual ( inpit ("Enter list))
Ent en Wat 1 2 245
USI NG EVAL N e to icdeatut tyhe by ooking
Expt. NX at qiuen expnegiiI
Page NO

y evtal3*10)a ealmput("Ento)
13 pAint lq) Pait la)
30
Op nte: 1t2
3
eAVERCINGHE LIST
AaneAal Meam
eac elemer
-taaveeaal looping ve a Lq)-
<item i 2st
PAOCA each utem heA
t 23,43
E wORKINGlaep vowadl auano
PALat L)
2
anel
4

Com D-ARING LIST LomposLe eatov ,>=,<

LL LL2,23 -Lennta iaddiridual elemeut i


L2 L 2,3 lepic ographicol osdles
L3-[ [2,3]] Rame p e a d a t a h e only CO
L =L2 be compared
TAue -iat d Loaleite nmatcbuia ualue
>>> I-L3 a e comidesed egual.
Faloe e l e m e u t llfe tem t
>>LI <L2 ine hesed { e baais d
fala JSE e m e t
E r :Ly L,S, L< Ly > TAue

Tyheanov '< net aubpeded bef Jnt at


Date Teacher's Signature:
LIST OrERATIDNSJeining RepicstisgSucing
JOINING Concate notiv +)
chem lT) uard wit tuso i s t , joins 2
Lzet
Ey: LCi,2733 follous ltgiue e. tyaao
L2 4,S.6] Ltt + int
Lest + sta
L1+ L2
-Concate rate Ony i s t to Lat
C1,2,3, 4,C,L
t-) anpm meit epeato uwoAt
Ex: Li+ = *ab element
aine ee ao it aRol eac
LI
i,2,3,a,b]
6t e a b l e to s t - l o n l y fov e t i r g
not fov nunmbe
wsed
REPLIcATING/ REPEATING : - X) o
Aequine ne opesand as list
EX: LI- ,2,3] a nothe a int
LI* 2
Ci,2,31,2 ,3)
SLICINGINDExING:-LE: Ael ttem at naley t
inalep stau usith ,
Sam:eqLta stof]
San:AeaL[staid
-L[Jad new kis, Containi-
EX:L-Ci,2,3,43,4] iojecot
oe .
idereo bet iA
i excludh
2 3
-Lant indey net inelided
C S 4 - 32
LCI:4)
2,3,4]
Reg-Lstont: stot:step-defautt step votue )
L[:42]
C2 4J-(skib elemeut )
L[:7 statng0 ndey finet, uait step valuei,
L : 1 : - stastiag taom inke s to last inoler, uaith step value f
LL:-17- eed {he ist
+Modifcatida
Expt. No - Cg
Uhdaton
Con be
oinaolices
ttaed t oueswmt ememe s
elemeata tctilt ne m@rt LLt
L L12,31 LIE L 2 ,3] Li=LL2,2]
>>|LIL 012
L a b 1|L[D:2] = 'a LI[2: ] - 'a
L L LI
p Dab31 a ' , 31 L,
2,'d&
>Li 2,31 LIE [L2,31
CI1o:12] =a LI D:2 -3
LI
L
olp Cl 2,3, a,L']
No
ety iade tealYe
voLlue puil Aoage

Makia Tue Cob e iat


u w Andlehemderl tebs iet can be made
ALng Aiat O
uGuin a a t to another ideatufiea
a , 2,3] WORKING9 you uill meliy sta,
b istla) b null Aemain Unchouged
b bath the List aue indepemoledt
,2,31 eacb othe

Lepmethod Stong all elemeni Lt


Ex LL2,31 Uoing liat plice in ia o
b acop U L
List[3
b a L 2,3]
i,2,31 b= aLo: 3]
uoiln9 2anae a b
wingiat*a ,2,3
Date
Teacher's Signature:
make a py Liat Lwoing asugnmertt
3ut,9y0 o boint whese Label
t wuill
wwle ahel b
make
operatou, in ai uncll
youmake ceanges
a i oboinding.
eltect th6 alo a 2 34]
Ex: a Ci,2, 3,4J
b a
al 22

a
CI 22, 3, uj
b
C,22, 3,43

METHODsE-a= C),2,3] b-l4,S, 6]


,

AST+UNCTIDNsAND

Sm Liateoj>.<methol uame>)

liet
LEN ) Atus emgttyle asgumert
asgumerdt a t
numb S
Len kliot
tw en la)
0lp:2
iat U-Aet iat eated o m parseol agumert
poMedd agument eould a20R.
babsedit u eReate ofoty il
a
Liot CL aeg>])
E a-Liet C'abto') Junt tam cha fardud
lp: Ca, c 'JJ
a-iat l) enpt liet

a a liat (fa:s ,b 23) liat ueate Am


keyo
Ca passel uonasy
ndes ) ; -Jet
ndex o4int
Sn t . inder ete m moteheoitem fom iot
) aC,2, 3,3)
E a ndes [3)
OP: 2
a indep ( )
Expt. No-Valuue eLo: 4 not cat
Page No
( appendl U;-adds dr item to the enel
emel L
6 iat
iat. appene L2item>) Onl One iat
: a apbpemd (u) element can
added
aappemd lC u, S) neplote
C 2,3, ) dele
23,E4,s ee men e
ertenel ) : - add uultpl eleme,ils t o a lst
apaends alelenmeno aLsaeitliat
he List s
pnCatextemd (elit>)
Ey =[a, b.c t ex l i a t f b
tz d , ej _addins lit
selgg d teptenol t2
t
Ca,6.c,d,ej
t e fod lpd e])
Ca, 6, C,d, e)
S

iut 0 Cnotia ohedle at a ginenp0aibion


Sn n t BN<indrzitem z)
a ieut ( 1 , 2 )

elemet b AmeUeel

o0ato nd ue t Dup
Spa Luat. osp l<d)
e apop lo)
a
Date z 2,3 Teacher's Signature:
lemeul faom at
toemone
Lial
lal
Pot faon npty
Lndy Emo
ta vclue faom Liat shaoy
t emoul
(6) enmone )

uwe <value )
Snwat value
it o e s nelwn ant
E- Aemoue 2)

Cz J
9 value doeant exiatxt gies Value E3re 'x not st
i t

olj liot exist


0: =
leaear ()- Nenoves all itenm lonm
ea Lit
Liet becomes Cnp
Aetuno nthi
Su iet.cleau )
Ee aclea )
a

1 e l : - i a t of deleted
Aetum notung
Stn >del a d e l a[o:17 a l e l aL:J sdel a lo
a
C3,1 delete ue
Aelete alueo Aelita e l value ot
A Ad. 0 lo J
e d oto lat Tdep
praltton O
( cout:-netCut o the em that o bassed
med as
asgu
ttem no
t, t et z

. a. C o u t () atDU ((D)
1
EXpt. NO .
Page N0

AeNeA the ite


docont_ 4eat
-_dees A av asq.
on- Aeveco()-do AeeAstna in place

3 9 1L

(3 Soxt 0-At item b defalt incReaALnG OAdleg


idle
-doveiv plae
doeawtCueal new Cist
doeo Ae any List
Sepa. List Aost[[eAevetse falee/Tawe)
a ot LheverAQ = LSeu

C,23,4J
-but a l e x nuna.bes laptlo doe
hone Ordletn 3el lolex umblh

aotecl ()-ake noame kit asumea

A a ne AAleel lial
Spr 2oted L itesablecq ),(Lemesse =falau/TAse 1)
E- 2oiteol (a) l, 20ted (aAeeRsLFue)
>L2
4,2,3 4 Cu32 3
tn aed e trnen
mn Aet
unioaLAm_Valoue

E min [a)

Date-- Teacher's Signature:


16 max take liat o almet
J e t max dabue.
u max Cist)
UR,->max (a)

Sum) -take at ao
agumed
Aet pum O the
ele meng a
u m lm i a t )
E.-> Aum a)

You might also like