Python Assignment 01
Python Assignment 01
Date
Name eahuleNshad
stTYB8A -CA
Sul PYBhon
Assiqnment No 01
priotitHes
o1! hai ce
Aclct iona
the
(ollection
bicdionange
ohich ic unord enel
Chanahle indered h python dictinanie, ane
coaite coilh curty bracke and they have keys
nd Walues
Prepentles -
alUnordened 0àctionaniel stoe data ia Key- value
pairs uithogt orde
2)pautable Yoy Cen modify diction o2y ualue, by
key
)ndexed b Keys : You accere iteni uning unique ke yg
)no Daglicak
Daçlcate kos: 0ictionanie
eath key in dicticnany muyt be anique
5Dunamj ize Dictionanie, Can qroa or shink od
needed
JHetogenay
value keysl keys &values Can be of dny dataAye
a)nested Oictionanit,_: 0ictionauie an Contoin othen dciaa
2) Hauhae Keq only irnnutoable tyee cAike ctrings, Nunbens,
taples) Can be dielisnsy ky
(Pago No.
Dst
02
-
q2. Expkuin any taio tuple opeaation ith enanple
hdering iAcessing tuple elemnents by Aheie çaction.
bup:(lo,20,30)
print Ctuplil)
houtput : 20
2)Cancakenation Joining too tuples using the + cpenator.
tup 4: (1,2)
tup 2 (9,)
YeSult :tud t tup2
pnni (oeSult)
# output : 2,3,)
Expleun func tion Arquments iinde taiL
Funcfiana arqument. aNe the ral valu pa ted fo
(ond receiyee by the function
In puthon funcflon aunquments contol hocw oe parr.
data into q function
Aspes of atqunen is i
formad Aradmentsi A funct ion can be definet caled
by using the follocu ing ypes of formal ang antak:
-befault Qunqumen k.
-Requird(Positional) nqumb
Pege No. o3
2) values ()!Retunsal
-Qll va luey
Key
tup2 =(l, 2,3/4)
s)offenence bekween t lit R tuples
) Mulability )list is Mutable Cmodlified)
b) Tupples eent Can'! be modi fled
i) syntar B)t) Squane brackets [T for ditt
fiPaonthe gea () for tupley
) Penfofmaonce : a) List Stowen due fo •muka bil.y
W
Tuple: fasten due to iromakau bility
A) Method a is: Has extenske me thelt Ceq:, apendl)
6) Tuple i Limlkd mehods (only oun t, inden)
v) Mem074 a) (ist hoy highen usaqe ar erba men 0ry is aloca bel
Tuple had lowen, au its optm ized for inomafabl'y.
u) Safe ya) list is lers secuae ad ikns Can be ckangd.
b)Tupes is morc secune, Since ifems (ant be al fened,
Paga No. O6
Dats
def funhion•NamelJ!
Fenction Name)
Page No.
Date
tup I,2)
print ( tup + 3)
QISthan. Progto gemt chanach kens at
Indite