NAME SURYA KRISHNA,S
REGH No : 727g22TvcvO28
COURSE PYTHON PROGRAMMINGI
COURST cODE: 228B00S
DATE : 27224
Reg. No: 721922T0Cvo28
Date
PyTHON ASSIGNMENT -2
PART- A
0 Exdatn the d'lhene between the' opnund and'extend
Apund () adds He angumunt as aakngle oement
to the eel a a ist le entendtakes an ttenable
adds eacl dements o< the heralte to the st ndiuldually
hae ist on nmhes - [3,7,2,8,4,sl.Creat
a vogiam that putbwns the dollutng qyeratiom
Ayund the nunbe lo to the endl e the st.
* Reuese the t
mb =3,7 2,&,4, SJ
hum bes. ayend (1o)
AumbeNs.tuent (2,)
mbes. sertl)
numbes. Yevesel)
Prtt (mmbws)
3) Exloatn te Yemane() method f
he'remene()' method in ython ts remen the dst
oC Cuence o a sufed oleiu t . eg:y-ut.remane' 3)
Dencaibe the payuoeohe popc
The method in yhen AJenenes and netuens the
Last elemuts
DDebe the opc) Method n
f'haide
ythen st eees aud etuns
Explatn the dffenence btwen tuyules ond hat nyton.
(when wpld ?ustead tists.
oe fmuutabe squen ces,s e last are talle
qunus wee aentses c)wuile st se sQuaie byacketc)
O Lxplatn the Concapt g fmymutablity fn tules and lkow t
Tunls fmt alse neanng thea clemet
Cumnot be danyed afto cneattenn, wmtig olata nteantty.
wftk
(3)
8 what is the ywyen o the enc)cncin sen w
? Hew dos t difte tom ists
tupes
(ists
fn the tyle, counts the lo. a, elements h
(ExNatn the mechanism o] hyles o tndencng ai aicina aconcic
1ules tndendng retienes eloments et suciite potions
strtng om O; ing otakg a gubset o, elemets
sucdted start and end ndicu
How tten can eu ue ist Comprelewwiom to iltr alements
hom a ast bascd on ctan condtis ?
y-ut pf Condion()] to tes elemnt
Sist band the Cndion.
PA RT -B
Erdasn the dffeuene behwcen to clone alist fhn ythen?
Explatn te adventg and ditedvanteges 2ach mothod.
Prenide code oramnple demondbrntng the clautn4 for each
Muthod.
Adxowtaai **Stmle anda conise yatane
Creates a shallow cory o the st
changing to the oigtal st wont aftecks
tae cloud lit.
Dlwtaadnondage:*Ltrnited ocreatng hallew coies wlich
be sutalde ter hested on comylee data
stncwe
LRst conutctts t c)
Adnentag :
* ofters aclean and enlllt wayto crete
fworhs well fos halluw cotes
Dhadvotag:
#Stlanto slicng , y orates aio
cardes.
eiiytnal_ 8t =l, 2,3,4,5
OFxplatn the cencept a genenaten eapreston f y hon
effiieut
A ylon queator eyesion is acomciey wag
to qpheater oject, wice qlneNatens values laztyay
Ahey ae nueded , Yatlw than ONeattng aud Stonny
oat once ke o Ust comprehenten
Awgulel , Gevenctor enession ae milar to lest Comprefon
se paehtieses 'c Basteao
brachetSC]
qneater S(x**2for x hu rauge( 1o))
hs genater espveston qeueates tue auae
mbe lham O
0to 9. The wye o, pcuenthees hutead
byockets.
-[x* 2
Jetcomp 2
pint (vale)
(19 Creotes a pytlhen progham to qet oa t ,otecd in
neveatng er de by the kast
det sortbunlesby- ast olements (huples lict ):
# Aort tue list d tunles bened on tle last elemacts
setedlist
#Exemle wsage IMan
tane
tuple st -[ci3),(s, 3), () la4), (2 )
pit ("Seted Eat: Bote d lit) li)
gnt
to asign mutge volale in a stnae
alow you
Code maktng the Code mene cowslee ad
ytlon Can metun tue nd
7eadati,dndions fa uython
oonmentg make b convtnient tocanta
furle
Cvdlue) Rrt
value
,u)/rej) (,213),
(t tue hested..
ucihyfoy by
leuel each
e elemerdc acce cun Youc nenting d
ltuples
eveltuouyh mtubn
nawiqate frdesdng
to vales ytlhen
tn fr
tunle soop ted nes luatn elemardg
wt Accesnog
este
a
age,iy) Rahitname,
pesen-tnfol) get city ge, /
City aye, (nae , phnt
2)
tnto[ y
[o] tnto :
nfo
York Ne
Allce
ac eies he Second tunle wtaÃn
te qut tules ,adCecCeses the clements at hder
I wftutn that tyle , Beytng nthe vale 's
vetieneod.
eated tuple (C,2r2), (4,5 t), (191))
value - nested-tule CiJCJ
prfntl value)