0% found this document useful (0 votes)
18 views13 pages

Xi List Manipulation

The document appears to be a disorganized and fragmented text discussing various programming concepts related to lists in Python, including mutable and immutable types, indexing, slicing, and list operations. It includes examples of list manipulation, methods for adding and removing elements, and comparisons between lists. The overall structure is unclear, with numerous typographical errors and incomplete sentences.

Uploaded by

Satyam Kumar
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)
18 views13 pages

Xi List Manipulation

The document appears to be a disorganized and fragmented text discussing various programming concepts related to lists in Python, including mutable and immutable types, indexing, slicing, and list operations. It includes examples of list manipulation, methods for adding and removing elements, and comparisons between lists. The overall structure is unclear, with numerous typographical errors and incomplete sentences.

Uploaded by

Satyam Kumar
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/ 13

Lt Manubulolien

Class-XX
Lsls i Pythens Combeund dal typeA Lutn Pythen Juprenli o e t _cona
AlpaMatid valus oany dalape belween dqyuar buatkalz
Ex a 2o,,16
Pyuthen usli a mul ble ie we Can Charge thi elemunli _ a l s in blac

Cualing Lul #embly lut


L= l u t )
enbly ut
4 0 , t,4,9,16, 25,36, lengla Can be splut alKas devenal lne
49,64,81, 100,121,144

l [3,4, (s,1,7] #Nestad list

Cualing Dt pem eising Aguana


L Dist4eguntu >)
L Diut (hollo')
int (L) ['h'e, ,V,o
t -(9' 'w','E, R'"T, *Y')|
L i t (t)
bunt (1D [ ' , w' 'E', 'R', 'T', Y'J
Auessunq lsi
L H
< Negalive undex
4-3-2
AEL Backwad Tndexing)
Index O 2 3
(Ferwand Indexung )
L47,Txueood,4-59|
L= To50
Lust sleu a ueunte at eath ndex
ndhad osleung sunge Chaartiy as

2 goc
tach e tha ndindual ilims e the luut au stoud
3 459
Omuuhv else n memey

(How Lu a inlbnally eganused)

vowela'e,i', \o','u'
unt ouel ol) 7elemeunt at Lo" nder a
punt ouel-]) u
prunteuwel -2))
unt (vowel5]
Du nu Lem Sungs
S = Hello"
Sungs a not muulble
Luata ne muutable S[=E
a t nder elemant
astungs aL Net
muutabl
Ls urll gat changed
2 ut a mulable

Lernbaing Luli
L 1,2,3] L3=,a]
L2 1,2,3]
beunt u= =l2) Tu
peunt LIE =L3) Fals
bunt ( K l 2 ) False
punt LKL3) >Eug as 2 elemunt LI and 2 elemnt e L3
ae no Combaable ype
LL2,8, [9, L d

CL2,8,9KU29, elemante tioista 6 uu


CL2,8,9 KL,2,9,1oJ
(2,6,4 >Falea elemun two lusi K4 jau
C2,3]>[2,3] false
2''3']<[2:0,3.oJ Fal
#Fe-t eual,number elurun muut be sameand han
C2,3)==l3,3] Aami malhung alue4
[2.0,3.0= [2,3 THDe elumunti
Combpasud
ae gnool and only values L

Fale
[e3 [2,3,4J
Lut Opaliens
0Jeurung
Bunun s -[L3,5
2 [,7, 8]
a 1 t02

puntla) C,3,5,6,7,8]
1, 2, 3 -1o,12,14, [20,22,24],(3o,32,34
14 2 t l3
pwnt L) 1o,2,14,20,22,24,30, 32,34
I +2

2 +abc"

Rebealun9 er Replicaling luut

a l 3
un(a) C,2,,2,1,2]
Slung the Lus
LSE sluu a thi sub bat o a lut ecuatkad_out

ut lo, 12,14,20,22,24,30,32,34
st33
un (4eq) 2022, 24]
ARq = 28 element at undexI u modyied q tu seg'
unt (a (20, 28,24
Dit l o ,12,14,20,22,24,30,32,34]
3 0 is eut o beund so lutung wll b dena kon 3 5 last
Aur(2sl 3:30J) elunont
uint (Lut[-15:7]) 1 5out e beund o allcung uwl be deruom
wut elemunr 6 elemant
ans9 o,12,14,20,22,24,30

L [2,3,4,5, 6,7, 5]
u t (LIl2:5]) (4,5,63
unt (LI[G10]) upbe Lunut out o bouud ans 8]
unt ( L[io:20]) Bsth lumud a x sut e bound, ythnues ho v m o

and xetuouns an empty sung


[ ] tmby sbiing
Slic sibs
Ae at:step:step
Lut 1o, 2,14,20,22,24,30,32,34
unt (Lut [O: lo 2 F urlude w e 2 elemurb

As o,4,2230,34
puntLutl2tlo :3]) #untlude eey d
elumuntE
Ans1,24,31J
pint( e t : 3 )_ r o sant andstsp gwven ,only 4tep gven So
d
unelude whelu luE piLk vey 3 elemun em ta l
h o 20,30J

AR Lt::2J #get evey ethu Qemunt, slauing en out


489 Ll5:2 #ge eveiy eth lumunt, slanling em5wndex
LC:1 en a ist

Oungslus E List medyualien


-L= one Th"J
values to ust sli
L[O2] =[o,] assgring nuw

bpunt(L) an L0,1, "hx


Lo:2)= "a"
punt(L) anu["a", Th"
LI=LI,2,3J
LI2:] "Go4
prunt (LI) ,2,'G 'o',
LI2: = 345
45 s not a A9juc

LICIo:20]= "abcd"
unt (L) [,2,3,'a, 'b','c, d']
t lmut out o beund, so ullou au
apbendad lo the
end s t LI

Making a bue epy o a Lis


aLl,2,3)' aDist

Method b liut (a) # uatb is ndipenden o ist

Methd 2C a copy
Method 3 d Lust L :

d-Liat2:5]
Lat uniiens and mathm

en -utiuuns lungth e agumant uuE


b-[2,3]
a rB) 3
unt n (t4,8,10o])) 3

2 Lust O uivuns a list vuatd prem thi bassudaumnt,uDuh ahsuld be a

ARGLuAL pe(Aring iat upl) noasygurnent baud i t will urat


an embiy i s t

a " Hello
b uist (a)
punt (b)
C st((34,5 o)) uble Convead to list
tuple
unt Cc)
34,5 lo]
dDestC'a': lol 'b':201) dielionasuy koys Covertrd ts s t
punt (d)
wndex C. relns thi unolex o ust malchad Tun pem tha kut-

LI-3,18,11, 16, 18,/4].


puit (LI index (18))
a Ll inde ()
buntla): 5

brunt( LIindex(33)) uH 33 net n tha u t

abbendO >
Jt adds an ihm to h end ethe iut dees net u l i n thi
nuw sEput mooiiesthe ognal list
Cele 'sud e n 'blue
Col.apburd e l l e u )
punt colon) ad, un'blueltso'J

da
-

['m't' 'w
day apperd ( '
unt (H) 21 mbty a apburd ) did net
Huttoun any alue

punt (day) ['m,'E, 'wt}]


S eind t is used to add muulliple tlemunt to a list
t1 ['a', 'b', ' ]
t2 ['d,'e')
tleand(t2) Extnd tha i s t tlby adding all elemunb et2
unt (tD ['a'b','c,'d','e'
u n t( t 2 ) ['d e]
t3 tl- entindt2)
bunt (t3) t3 em as artind O did net wlivn any val .
but t extnoded with elemuni ist t2
nssriO n u an elumant semuutuu n belween eA a peaulion you choucu
Lo thu t
t [ ' a e u'l_
tlanst (2,'L) stname nuet (ndex, elemunt)
tl. nent (0,'') n s w t t m at oh unden (in th ent)
tl unst ( len (&)m') #unsout ton at tha laut index

bep pepC) is ustd to xemave tha iim Lem thi lst.


tl['a,e','i,o, 'u
elemen= tlbepO Hxmees the ast element pem the s t
unt element 'u
umant t1 pop (2) Hmovws th tlemnt at 2 nden
punt (element)
. LmeveO=xenDvesthe ursk occuounte 4guen timem tha Lua
lst-name xemeveKvalue )

tl=['al
tl: nnmeve ('a') EE t ocuunLL e a ameved
e m e v emithed deu not ralun anythinq

tlumeve (w') RuOL w u e t un u t

. clea - m e v e s all tha lim4 pom tha u t t buemes emby


Lstnamecleax()
L[2,3,4,5]
Ll.clLaxO # as all t h lumun
brunt (LID , tmbly E
(o LounE)-Cni th suuuunu e an em badssd as aaumint: Yquenalimu
not in the luw
Lst-name count ( {tun>
LIL13,18,20,l0,18,23
a Llcount (18) ulur 2 a h u u a uo Ocuuntes 15-
bunt a 2
b LCount (28)
punt (b) tE O as 28 isnet in the Ast
t e x u e ) » uvess the ilm h st No nw Jst i ualid, t u n-pata
wt-ram vul
-l',,'2,a,9
punt(tD

t2-[3,4,5]
t3= t2 xuiense) +t3 leus nsthing as er dei net
brun (t 3) uun anythin
12 t )- serla the lirns thi lut, b diyault in nuang d e i h u i den in-plae
st-nam sert ( Cueu Falu/ Txue l)

tert0
bunt(t)

13
13. ued ) - t takes the nami
q the ut as an aiguant and Hiluuns a new etid iut
wth serlid elemuntr in
sertid (segunte>, Lrvese =
)
False.

yal= 17,24, 15, 30J


wal= Otad (vau)
Dunt(sual) 15, 17,24,30]
ual solid val, xeL - Iue)
beunt a l ) 30,24,17, i5
mun) manO, um AiLn the munumun elemunt, manumum elemnt um
elemani qth Jst
min (Lst )_ max((Lut?) dum ( Dut)

val17,24, 15,30JJ
a munlral
b maxval)
C um(val)
bunt Minumum a) E 15
unt Moumum b) 30
bunt Sum c)

You might also like