Assignment No i3
__@\-_| hotis data structure2z bhi ch Data_structi re ——
bsed by Python —
Python ysers Variot e
and manipulate data efficiently some of
the commoniy vsed data structures in pyshan—
include -
List t+ ardered Collections of items thot can be —
of different Dota types _____
Tupley !- Similar to lists bus‘ imma _uboble Cannst
be changed-
ee Aered callection: oF Key-Value
Rois
sets! Unordered tollections of Onique elements —
yoos nade and child Dade |
| Grraphs t= Catlections of mades Cverdicen}
| and edger thot Camnect +hene
Aoder-
—————EE———— lSwhotare the, different. \ operators thot can be
performed on g lish?
\. Adding elernent -
Waseenisiishadds
DH appends!- 7 mecified element to the |
——_—_last_position—o f£ the Vist
Big. Vist 12L lo 00, 30! Ger
List |. append (sod
—prigt Crist 1) :
Ourpur t- L\o,20,30 4a so}
f_insert 6 +h insert the clementot specified
Sq: Visd 1s Te Win diy smokhs’ S Bagi sh
Vist 1 inserd C2." Sanskrit)
Qrint list 15
O10 SIG wou Wa torn"
wT. DPD . . . Qa
2Q: \iss \= Lilo 22 207}
Liste = tl isos as, 4s)
List | extend Clist 2
oe CVs £5
Obs uk =f lo 28 Bo V2, ST ASD
2. Delele ar Remove elemen*® Cram lish
@ deli: 14 Can yemave aneor Mare elements
Prom she lis} ar even the entire li
eg Vish v2 LN,%,3,4 5,83 prins CVs
de\ \ist= Ly ousput L124 5,63——~ /
se 2) Speciy’
“@ vemove o=_this Sunctl on
Gg lish = Lie, 22,3882)
tout i= lish iL 1e20.48 a
@ Pop O -- This Punctian remove Ffement_
Eugt- ish i = Lle 21030 4od) =
ARTS pir)
ourspur - Ll\e20 oy
Oa aa ; 1
Jp Rlementd Crom aq Vis yo
ag ie Vistiscleaccy
erins Clist i+
| _Sudprit — ¢shat is tuple in pyshon How ta create and acces
4k
‘SpoaieL Lg Sa NOS gata
14 allows \ndexing Alle >.
Noles > Be Se creda tate
@.gt- tuple | = Cle 20 30,4050)
Access tuple
OL Soit= Fe
this means once owy
Wmmbtable Value Cannot _be changed.“
\- Number : ~~
7
I. String x
2. tuple \
Ws i C 9
Compiler numbers
Bigt- pind 4 Float
Oum t=lo a2 \a.—
1 :
x oy ®
®g- Str! =" Wwelcame bo python"
p> Tuple:- Theyare immutable they are teprerent
,
ing 0
Cegi- tuple 12 C \o,20, 30)
List
o-set
a Dictionary
i a .
To Crease q list place items inside
V3 seperated by Comma.
in Sed t- THis Onordered K&unindexed Callecttan _
ef ivemS-
eSe MmYsek = LUUS "Helens :wg
~K
-
oe .
| *xuple -
—_ ,
Wwe_con delete an entire tuple, if it i
required.
Supe! C lo 20 %0 Ya Sod
del tuple — cease ree earner
Print Cruple 1)
Concatination oF +uple-
Adding anoiher tuple into previous tuple
|
tuple 1 tC la 20.30 40,50)
ourpiud t- C\o,2u30 Qo yo lo 26 AT Uo a\i eAnd how to Delete and Concentrarion ¥
tuple in Python
Ddupie in Python 1s an ordered Callections
os ~ :
7
may, le} + if x .
i ibs immutable posture .
Hoineuer—\you_car delete she—entire tuple —
osing the del Meytoard -
1
| my—tuple= O,%,9,4,5) |
Teoh eee ae angina indo eaten |
| bole oC 12,8)
| suple 2 =C4 sis)
Concarenated 7 pI 1we
a Fare mutoble ond immuohle 4ypat— _———
Tn ython, mutable types are daa Ay pen tohose—
Akants can be ch
shite 3