0% found this document useful (0 votes)
6 views16 pages

Understanding Mutable and Immutable Data Types

The document discusses various data structures and their properties in Python, including mutable and immutable types, lists, and tuples. It provides examples of operations such as adding, removing, and sorting elements, as well as handling duplicates and counting occurrences. Additionally, it touches on input handling and basic statistics like maximum and minimum values.
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)
6 views16 pages

Understanding Mutable and Immutable Data Types

The document discusses various data structures and their properties in Python, including mutable and immutable types, lists, and tuples. It provides examples of operations such as adding, removing, and sorting elements, as well as handling duplicates and counting occurrences. Additionally, it touches on input handling and basic statistics like maximum and minimum values.
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

PAGE NO:

DATE:

UNI1- 3

Sol mwlable
Lheh can hold elenmsak dferenl dala hpn
key caoaLtushzs
Mulable I can chango, add ar eLnoVeJ
de7ned adeg
Lan havl dpicate alues
dynamic Sine

- allos mdlahor

Compaae
ITuple

Mutable
Jmmuble.

yaami dala shorage, xed dhh shage


PAGE NO

DATE:

elLmak ohich allos

L alaus padißkain noiutdsa lelemenk

aua becrcalerend and pltaled


L2 Co, Pyhon , 57

ound L' Lodg ",nuho" 5

L=l1.2,3J
iseO Conslsnt

[Link])
PAGE NO:

DATE:

Jndeung
1E LD 2, 4 5
prn/ ( L[2])

laatr
Repehao Reprul elemah wnng he
LE L1 ,2]

p con Catknahdn

L9 l5, 8 ]
Daat(t + L9)

L= l10, 20, 30, o


2nt ( 0 in L

L2llo, 20, 3o, 60 7


PAGE NO:

DATE:

Coun eren hunhy


n 3, 4 6 2 ,7,a7
D

eC+1

Buid a

Svmlnn)

ezanples
L I 2, 4 67

addsdn elemeat
L = 1 2,37

leutnd:adds mple elemest. jin anatta. iteube

Dnnt(i) L 4,5,6, 7,2. S]


PAGE NGo:
DATE;

L (ounl (elenn

L ,5,5,7, 5J
num

rgte =eglay lnum, ky)

temove duplias

pnnt may aad mn Lemn

n int Cinput (" Entn he nmby g elemnb )

or in in ange (n) &


num int Cinput ( Entes he elemens t )
L apnd Crum)

Sorted_ 3t = sored Cset lL))


marium max (L)
min (L)

prnl 8orled LiB) wih do pUcahao ", Sortd. w)


maaioulm glennt maNm )
PAGE NO.:
OATE:

elemnb at eun igdleD

n int Cinu7 (" Enta he wmb lenents "

s in (inpUt LEnjen he elemeny & ))

in ange (o, len (), 2)

not

onc elem Jpeeßied tnde md

delet
PAGE No
DATE:

llo, 2o, 30, 40 SD


num
del numla)

num moNes |50)

Plts del) t Lio, 20, 4o, 50]

num L1,2, 3, 4, 2,5, 2]


= num. index (2)

he ale 's mder


PAGE NO:
DATE

DonobtoAe ihednc beleelnBYC) ead

uhih meant

num I51 ,9, 2]

DUTDOT -

even-lst ( L1) :
dey
in L1 :

[Link] ()
pant an jllad lse" 29_)
PAGE NO
DATE:

ne hmbu lement
n int ( inut (4 enten

i in gange (n) g
num : int Cinpur (" Entn ne elemnt :"))

or k in

else
odd oard le)

pint l Evn list :",


Jant l Odd st " odd

19

Slaced

shdent =L]

2 inF Cinput l Enbn he mus shdsot


ghudnt. oppad (2)
he mat(shdnt )
2 9ar min( Shdent )
aug Sum ( shdeat)/n
PAGE NO:
DATE:

Count o

Contt 51

eih eple

Max )
mih

num = 10 30, o , 80, l00)

index (10))
panount 80 Couat (3O))

OU1PU7
Masimn vau 100
ir4nimUm vale
9
tosore
e wed Vahe
Styyene dala kypL) The mwt

inmybll seanl:

: ¡mmw tubie seysnle Chunactny


shong

ba a
b LoJ = 1*

Shalles cony
(Yeotsa

orgnat l1, 2, i3, 43)

shatlow LJL0 449


pont (

pant
PAGE No.
DATE:

esjud al asignt eiables


0 Coea
ihdepeioy

a Lo] = 100
PAGE NO:
DATE

Lineo Senck

one one

orahue
LinLas iteabe (b ky)i

eh m '

rhin -1

dey Linesn ewtve (1,


nde JanlL)
thn1
key
PAGE N0:
DATE:

pAt fahe Lineu Slaoh JineaJteohe (aum, 2o))

lest mld t1

Dam = I 1 . 2, 3, 4. s7

binay luatuJeoteh 3_1


|PAGE NC
CATE

num l lo, 0, 3D, 4o, So ]

22! (rplun is Contalonahon nd ust gphcabor

L1 l1 ,2,31

Contattnahn L14 L2

Jant ( lontatnatcl lo) Cortoahon )

(onatnotd hst : l1, 9.3, 4.Si6J


nylahl B) (1.2, 3, 1,2, 3)
AS N

corwe?hne

tL12,3)

You might also like