0% found this document useful (0 votes)
2 views12 pages

Python Unit 3 Mid 2 Question Bank Answers

The document discusses Python programming concepts related to tuples and dictionaries, including creation, accessing elements, and sorting. It provides examples of code snippets and their outputs, illustrating how to manipulate data structures in Python. Additionally, it touches on mutable versus immutable types and the use of lambda functions.

Uploaded by

madatgnan143
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)
2 views12 pages

Python Unit 3 Mid 2 Question Bank Answers

The document discusses Python programming concepts related to tuples and dictionaries, including creation, accessing elements, and sorting. It provides examples of code snippets and their outputs, illustrating how to manipulate data structures in Python. Additionally, it touches on mutable versus immutable types and the use of lambda functions.

Uploaded by

madatgnan143
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/ 12

PyHON

UNIT-3
AON-ASWeR ustONS
éto.
to vate
hoo to and aren

and dsu hoe tupw dtens


votaili

Gndangable
OUnd b a t

ma'mtan
y Con ta rn

’Atessed by Tdun- Itns in a


. be ateud sng Indi
- ’ t lan be
Eyeo otua tupl
Canot add, dlet
datnes

CREATE A TEPLti
Tvst
a

sqvae
bacet instead
Az(Ram", Kooman,. "Romb)
b-Cs('ra)
péint(b)

Ram' dizman Komu')

c'ajo)
IN A TUpLE
ACceSsING TteMs

acess
Can
iritng, negatie

as(10, 20,30, 40, So)


prit Cara)
pint (a-)

SO
(R0,30 ,0)
and dist n
differna betien
tams mutabiy
angt
nvadifd afen
Creation
van
Tups ed a toleoto
Condnt
shald okfd n plali.
Asts: on te semoveo Ony
Cav

ltoed h
slocoe dr
de
’ T pofomane is

PeoGeAM
a= (0,20,36, uo)

PaintC"eo:e)

b= Tio,2o, 30, vo]


PaintC)
Aoenot Sryt
EsY:topk' cbicct

50, 20, 30, L0


into a datoasy
and ts
is a
on ths lonveaon
'st Collect wheh
andchanqcalse

Con lorlan

oiluor ist

pictonaony
TBans
slorcd
tom
Veloe palns
valus n be

angu' toa
-lach y

1 mmstake and (on be Onle,


nmbe .
ittn
4=app', "bonane

QUTPUT
6
banena
3 Discstu

Ans.

dioa
spcuia value

dict ani tus (eys, valore)


Peoenn
pint (b)
oUTpi
:0.y:0,io
s)setdetati):
tdtautt) mthod ntms.
ohte Spe cifed
does no insent
Value

dict setdfawt (kay


Tit
pRoGRAm;.
Age: 2s
hlame
a: set deaalt("Age
Print C).
print (a) 5:3)
("height,
Ca:setdtaut
Paint (c)
fsint (a)
OUTPUT
30
^'Maine': Alcu','ge:"304
5"3
:0,'higth 's3
-lement o 'anF
a

an

ditoptat Curate)

aup
Puint a)

^'rlom;'etid, 'age';3,eity:Irda)
4) Demons tatot; an Erame
&ot dictonay tures
thay
-Ars]
(an actionay itrs
Valwg, etc

-’ ambda,
raombe bt
item: lanbda (å-itns()
ku (Vsold dit C
Vates
igo:,) by
C'kortad Feint
(stá(aritms
)) b=dict
5,
hoy 3,apru': banana'
PeoGrAm
hos ains:
()itens te
method
to
elictio
itams,
dicte
bsost Can
inalo not
on valoey,
Kes
bad dons s
dic On
valees
valos by
7y
".c)
Pitkooted by valus,',
HSot by valnes i .
d-dtlsootel iajtns ( ), kuy lanbia ittm
item], nevene =h8e))
volues

#. Sortd

t Sortd val

UTPUT
sovted by Ey5: aerlu'. 5,'bnana':

kurtd banena;3y
orsted by
banana 3 clasy:
|sotd ys ony :['Acpu', borara
appu ,barana

sotud vaive, :[?, 3, 6


QueSTIONS,
AnsTORt PACIINGr
Ccatud, to
ohect
Lommas

TOPE
oulonatialy.
:

ON PAÇIKI NG
aiqnak toq:
tudividu uUnfakà
>Tupe aknqnmat
tople ay

statmt to be

a a 'ed grcn ,;yeuo', uoe

Pint, ()
Punt()
int(
int
yclosd, bloe')

bloe

betweo ist e

Ars Tope List


iamutab a) Iis motaHe.
b) uses
st ommas
)oat becaus mutab
'mmtabu
d)I{ have limt
method muthoy io
Mocdlid'ico ion

a loctr to. ont ictongri e


g
a Sappl':1o,banara':s gnapey s
b dict Csonted (ng aiitm ))
Paint(b)

}'appu : o,banano ': S, qvapes'; Is


PROGARAm

bg dict (sonted (aitns) y =la nbda


;ture:tuoC)
pint(b)
OUTUTi
Sbanana'r 'appu': lo,

You might also like