Name Nitén kumawaf Year
subject __Pythen Lab class C4 (CSE)
bth Roll no. 21ESL2P
Srno. Experiment Description Experiment Date ‘Submission Date Remarks/Signature
4. |comp'lation in python b-y- 23
~*|2. | ces verave ve python | C- 4-23
|_s. | ese fats type £". 6-41-23 +
distance bly 2 poirdte 6-4-3
mumbs 1 odd ar evem | /3-Y -23
C. | greatat pf 3 integes [p-4-23
z. | mr Calculator [3-94-23
2
4
- | numb is prime or oof [B= 4-23
. ee Lowp o- 4-23
to. | prfat Pauntdown 2e-4-23
Ne | Calenlate ser. 24-23
(2. | deu'mal eg u'valeat 3-8-23
ts. | ist ond tuples in” python | 3- €- 23
; ty. | faops aver a. seguince | 3— 8-23
(tc. | gum af prime stambere | 3 = 2-23
ai
1c. | Sur of even = [o- 2 = 23
t-_|caunat- mo. of charactes | Jo -2-25
te. loner a. Jo = 8-23
to: | test Srle type In = 8-23
[22-| line im oeverse orde, | jo - & -23)
24 ly- & 23
cl
| 22. | meer equal tindion ly- @-23
[os | compute Coed m fy -8-23
[at hapleenanatge Soat ps 8-23
25: |sefection seat Insertion sext | 1g - 8-23ENGINEERING COLLEGE, AJMER
Date : qagite.... Page No w...fou
Name: og74em, foamed so Class C$6.2%F ,,. Group CA. ROINO RLS HAD
——p.sl& 0 : an.
he aa Env
lsewctonal stent that ouur uthin yau tum “4 pythen
' : Me wig, be
a | pxecess lithout spewtic , Cocamples~
uwe code {- You cfaot uuth the source code wor'tten
ln a (py) File, whirh contains the python
program's Crs tong
Leatcal analyst C Tokenbgalien Ji-
The pylon jrbtapridis
eas ic jal Is eo
x ‘eh
Pneant i Wwe idenkifiers ,
ee ae dentifiers
Parsing C synfar amafyis) £
oD The tekeens gre hen
an to engure. ney tollw the Carrect cyrtor
Le er. t/
ee. iparchy ~ isy
fhe todels gmdate Strusbure .
Garg BrothersENGINEERING COLLEGE, AJMER
Date : .... Page No ....2....
Name : an se C1888 srnserrnseee GFOUP 1-112 Rll NO.
Abstaath syasfar trot Cast). -
The farss_toree. is
Conve ted tuts an - uufan free Coat)
oe eee go ; ee
epee sentation of die uae Stoucture.
Com p{ ation +o Byte cede‘
The__py thon ted cs oul
Ine .
ower «fev.
bled by the pytun virctoal math ne ¢ ae
tor
foc _medulet, wluch “are. a) tn the
Ly,
eacting the Byteende!-
oa
hin you erecute a pytha
y,
R
<.
“Pre_bytecede is
thin _|naded [udo nem :ENGINEERING COLLEGE, oimen
Date
Nome nest CBS nennee GROUP es ROM NO:
LE ye tution: -
“The loaded byte Cede i veted av
exetsbed by the python Praberprebes qhe le
scraped eden
asad =. yae prgsarals lags
actandingyly
Dynamic Typo 2 -
Cs : ; 5
ontens that tae _[nbea peeks —debeamines the date
fs re nating »
Flexihi lity buat requires
fone, = platen ty, 4 at
fae p= fo pe—chelelag
ocuntione »
arg WarsENGINEERING COLLEGE, EES ‘
Dittecficnaititionnnnns Page No
Name: 21 fet fednta whaoncun. Cla8s : CE: af rea GtOUP Cigpens Bae Nap
—__@. ol 4 Ig wa 2
Ans
— oe
Tops c Tava. Py thon
= plabetorm dependent inuepeandbeuf? __—_Eralependenet
° 5 Poth, Sina le 5 epee Rath Single
| tralia possible bat emule 4 onnilple —
es by faint :
Efe, fates
—>| Execution __ cer 1 aguch fasber than Duc to frteapode,
z than Cte.
Suppo ot Leni tted ava. provides bythen hay a huge
Ita 329s Support
tor
like OL
omacules -
Garg Brothers< class ‘tuple ‘>
eeeENGINEERING COLLEGE, AIMER
Page No
Date :
seve C1488 5 see GEOUP esse ed
“Ms
——_Q.3| » el on %
Ane _| Code o—
fe .
ee ae Cte steer "Ram *
b= [rai a feet 1 fa
ce: { "yr Veber 2 ue! Ram 24.8 &
te ds a ead 2 \
a= Jo.23
f= 22
poizat ( typeCa})
point (type Cb))
potat (type Cc)
podaal type Cd)
paututltype fey
ee prieat Ciypt CfY
Gare BraheOufpup --
Ente 1: +
Enfe yr 1 €
enfee x21 5
enfer ys |
Distance = 7: 071068ENGINEERING COLLEGE, AJMER
Date: ssn
Page NO onGi
Name ssn O88 | nance GOUP ns ROUNO RES UPD.
—@.4. Wine ¢ pradeam to find distance —ble/ tio Coorcl/nefes 2
— Any: :
aa ode s-
= feat Casall” Ealie ei tite).
s = a
X2 = dloat( fnput ("fufer “2: 7 ))
= Heat (mput C" Gxter yo 2 1)
dz (Cx - xp )* 2 4 Cyn -yp Jew 2) HMSO
print C' vistance 2 P74)
se
Cae BaeOudpup 2:
Exfte @ numb
23 1s odd
Ovdput oli
nf a numbte
a2 1s Even
Gag Brora |
23
22!
‘lpName Seescnnne
ENGINEERING COLLEGE, AJMER
Page No 7,
Clase: Sites, GIOUP ern mnegicae.
——4-£| wip +o cheek the fmpuf numbte is odd gx even? _
fede_i
nam = int Ctrpot C" Luter ¢ otumbe : ” J)
a if (mum yg): 20:
pot C "Koy is Even ". formed- Cnum))
the:
print C"ho} is odd". tormat( num ))
Sona Oaexpt =
The largest number Is IM.Page No .&
ENGINEERING COLLEGE, AJMER
Date .
snmeses GFOUP «overs Rll No {ChNFD.
Br anreatest of 2 fort-cqers ?
oT oT
Name & sone soe C188
9.6. | wartte 2 pragram to find
Ans >
oe
code =
num = lo
mum 2 = ly
zy
mum ys fd
if (num 125 ny 2) and (num >= mun3):
largest = num |
eli Crum 22 = num) and Crum 2 2= mum)!
Larsert ema 2
petut (the largest umber (sl, largest)
Garg Brothersat fn meters U2
Enter your hely
Erber your wetynh tn le
your BMT 1s: 2469
your weiyht 1s arermal «
go
lyENGINEERING COLLEGE, AIMER
Pago No.2.
saves C188 ! ssesnsesesnsenee GIOUP sevens ROM NQQ CE AFD.
Date : ...
hibe a pregaara jo find BMT and potyd its
Cod eysmty
Se wes naund CC wespab/ bene *®2.).2)
m
he float Cinpul ("ernfer aur _hetyht in metkes : ‘y
w= fleak(inpul (“eter yeunr we ght fn ky tO
print ("welcome to the mE calculator. ")
wy,
pina (_* you gmx is: "Be bmi)
it bmi <= dS!
print ("you are under werght ")
elf as 2 bmi = 24-9 3
point ("yas ueeigt mermal -“)
-elsf as 4 bmi <= 29:99!
‘i 4
et
the?
print C “ ya_ave obese.)baa ‘aan i
Y tgppafse oe IR
ae @atambte 21) ia
Wis @ prime number. ae
pis. Wiad tho nts
- ' :
wget
; ant Yano
fi 4
ee Powe el w +
sath
Tent
at oveet
: tte mC ee
- sudo eo) Dat ”
1 ctrndea randENGINEERING COLLEGE, AJMER
Date : ... Page No! gen
ements C1888 !sstnsnnne GFOUP sores ROM NODC 4p,
Name :
9.9. |uinp to cheek whethe. the given oaumbe i
prin. or mot. ?
fode ?—
mum: intCtap (lente a. numb :"))
if num >! B
fori fn range (2, fut (mum/2 Jet): |
tf (namy. i) ==0:
ptt Cou “is neta. prime mumber wy
_breale
else:
say is a sum bro")
PS else + x :
¢ potut (num ts net a. patme saumber )Ovefpuf 2 -
Eva a numb 4
bo
kK x
fap
SEP Es ip
e UR RE &
ben ad
°
now
It
4
8
Ia
1b
Lo
24
28
Bdeh
3h
Yo
#)ENGINEERING COLLEGE, AJMER
Date : Page NO wnf-fornnn
Name: .
sees O1ASS Fnsneeseees GFOUP verre ROM NOPE LAD
—@.5._| inp 40 pefat 4 tale using while latp .
aa
ai ode: -
= Mum = fet Cioput C"Cufts a mumbe + ''))
jot
while ¢ t is
patut( "fot * Lit = 423" format (num, ty mum i ))-
fart :
(#2)Output
lo
numbez +
Eufen 4
°
2a
2H omy wa o~ } ENGINEERING COLLEGE, AJMER
Pago No nt.
NAME Ermine B88 rene GFOUP on ROUND AES fA)
hed et ko RA ROP te at
Gag Brahebetped =
CL \pytromsa\ python add.py 6 4 \
The. dum iss fo
t
dp)ENGINEERING COLLEGE, AJMER
Date : .. Page No.4
Name :
oe C1488 ¢ eeseeseeseee GFOUP ornne ROM NOY ES UBD-
ay e te
Wine, an guen ttf and _pefwd ihe funn 2
=
ede *-
A tmpect sys
xc fut (eys-argy('])
yz fot (cus. arqvlrT)
um = + L
pofout( “The sum ig : “, sum)yo =
Vio =
Os
© - 333333333 333 3333
0.25
0.2
0.166 45666666 666666
01428 STI4Y2OSTIY 28S
os
O-UE Ttt
ob---"=-=F AIMER
ENGINEERING COLLEGE, AJMER
Page No ... AG
erecerermnesee CIBBS 5 sesessenerneenee GFOUP. vere ROM NOSZI-LE 12D.
—opa__| at a
Yo i324 eo Vie Bact
ASS
Code 2 —
a
— Q=t
fer bh ange (2,11):
prlak (Ptah / Las "a/b )oupuk
F
Ast tn python :
C1,% * python” " progam’, ts-9_]
ie “amy! nr Ryan", AV Henry" 4 en ma"
Z qlass Ast '>
< class ‘ast!
J
Auple. fm pythen *
C% pple 17) Mpanana”, "cherry")
Cis 71973)
< dass. 'tuple!>
z class | tape’ >ENGINEERING COLLEGE, AIMER
Date : Page No Igoe
Name =... cee CA88 frees GEOUP snes ROM NOD CSIPFD.
Gig | 0 2 hy fi on ?
Ba tode:
= C2." pythn, program", is-9]
i dicta: [ Yamy't, Ryan", Henag’ ‘Emma! J
tuple t= (“apyle", "banana", hewwy ow
tuple 2= (6, 7, 9,3)
peta (hast fn _pythen :" )
point 1at1)
potuk (Lst2.)
podutl type Clit 1))
pata (type (dist 2))
L.
pit C" tuples in pythen 1!)
pit (kup i)
point: Ctapte 2)
pried (type Guple 1)
_pateat Ckype (tuple 2)
Garg BrothersPEP tL dab LL | gee
<4
D raviENGINEERING COLLEGE, | AJMER
Date © oes age NO fGen
C1088 | aeensnnsneees GFOUP 1 ROW NDA CE LIAD.
Namie $ ssnssnnennninnnennnnnssnnnnnn
Ans?
=
Code t=
= play tos = (“eohfi ') 'dhont "I sachin 1, "schwag pravil
for if fe ee
pata Ci.
P
: oocope =
Sum = 14291382 2922ENGINEERING COLLEGE, AJMER
Date : . Poze No 43.
I Sia OS _— Group ——— ROE NGFICM AAD.
Outs. : Ney belo
iit 2
fe
(ede! =
* = 2000900
ca = CTeue fer f fn range Cn +t) 1
P= PE
while (pp <=n)."
if (prime LO] = = True)?
for _t in range ( pep, mtl, ep)?
paime Cc] = False
peal
sum =O
za far ip ita’ range (tan):
a peime [P71 :
um = Sum + P
point C sum =‘ sum)
oS7
ENGINEERING COLLEGE, AJMER
Date : ...,
se Page No ng.
NARS ssnssssontesssne
vr CIN F snoneenees GFOUP snr ROW NOR INCS LIP...
to find the Sum uf the even- valued terms.
€
ot excee ili
Code l—
limit = 4 000000
if (Mimi f <2)!
print ("sum : 0")
else 2
ef4 =o
ef2=2
sm=z eft + fa
SS wibste Cef2 <= fimit):
fg 4 ef 2 + ofp
ef: = y* ef 24 eff
th Cefe > timit)
breale
ef =efo
ef2 = fs
sm: sm +t ofa
potent ("sum =" sm)
Garg Brothersan
ae
ra gle “com
{iet:
an
Bytol bya! 214 =O.Iz
ENGINEERING COLLEGE. AJMER
Date :
sents C188 f ssssseneeseees GFOUP rors _ Roll NoQICSHFAD....
Name
wap fo (ont the mumbecs of characfees fin the
stofng and Store them in —4 tot
ba rad
(ede! =
Jor faput ( orter Stating ye
dict = 4 4
for _f tn Sty?
if fin dict:
dict (i) + 24
alse:
diet CUI = 4
print ( dict)
Garg Brothers0
ay
Which person dobyou Wart) f want virnasy deb
vines} Birthdey fs &|~08-l90e
IeENGINEERING COLLEGE, AJMER
Date: a. Page NO 20 nnn
Name? cosseninininnnnnnnnnnnnnnnns C1888 ! snes GFOUP nee Roll NOt SLD...
@.18 Q Tr 1 jaf Hardt Pn the +hnf /
dthahardine A : ‘
ape 3
® (ede '-
dob=4 “motat "! 12-11 1990", “sudden: t7-08- toa) “!
" vinay": “'g) 08-1968" $
S4ort = frout C" which percon dob you raont ! a
Ls stro. split)
birth=" "
for fin L:
if if in dob keys ():
mame = £
Le print (! ". joind [riame ." eerthdey is” doh LnameJ JJ)
Garg Brainersoulped
fg ry tol a tet io tal: 45 tule, tha bh,
PIS ie ae let re ain ave eey
Ets a teod File.
vENGINEERING COLLEGE, AJMER
Date : ... Page No 2.4...
Name: . C1098 § os soessrcssersere GEOUP seeseeeee Roll Na21051490.
on tle - 2 the
‘ eee
¢ am file. tent tile.
Slee ae
fe "ey Desk top \\g-€xct ” L
file = open Cf, "r")
a:(I
beh t
tor fin Hle:
for fin range(o,len(é)) :
a ppe cleI)
for j ina?
if iinb:
®. blitsg= t
else!
bCid=2
faint Cb)
cof sphit('.")
iC cOy]= = “exe's
print CY win ie ts a eat tile")
elif cid ==" py":
potatC" \nin ve ts a python file")
uf “eCulee Ve":
eR thts ac tele
Garg Brotherscudpat ‘i
Enter the filename : fiten-py
tavamvk retin
nosrep foob &
st
eman' ym
me fENGINEERING COLLEGE, AJMER
Da
ate : Page No ..9.9..
Name = Class G10UP oreo ROUND CSD...
Q. 20 Aw p_-to spafact ¢ aba dine of a dile fn reverse order :
dnt
ale Code! =
>= es i ci wn:
f: eee dess Moy")
for ling in fs i
Vine one
er th AtS cranae Clem Chine Vnho = he of De.
line 2 = ers Jvne CehT
prtod ( [me 2)
f.closec)
f®_ =| _sitem.py t=
———
any name is item kumawat
J
jam a Cool pérsom
Garg Bromers |Oulpot >
Evfee the De na mes Niten-py
Hoof tines 2 ie
rovof words Io :
tle. of characters 34ENGINEERING COLLEGE, AJMER
Date : Page No ..2..2...
Name : pnts CIO96 einen G10UP wnnne ROU NGC [AD
Qian. e oe ree!
and Mine (nq file 2?
pws.
SSS
Code -
Ss filename = input( "te, the filename :")
P= open (filename ,"'x")
dew=c =0
foctine inf:
avends = \inc-s pit)
Az ty h
fer werd in werds!
nar =O ay
tov th in word !
Px _C=ct)
pated ("so af fines UA)
bak C''po. of words "| )
Co. of characters" ¢)
close()
ar item: py te
mame
(am _a_Look pitsen.ENGINEERING COLLEGE, AJMER
Page No .... 2a.
Name ¢ vnnnunntemnnniinnnnnnmmmnnits C1ASS 5 secs GFOUP sree ROW NO. 24-68 HAD.
Date :
Q.12
os fe +wo
Sdafngs are. equal, Toe storfngs a and _b
be b
| simple artiafething or.
Anst- \ \
2—
= _tede ! =
fejso :
wthile Cie lenl ste and j< len Cspo2)):
if (str Ci] f= sto C5) :
count = court +1
if Clem (start) > lem (stro) ) :
£2 gs Cet
elif Clem (st) == len(sto2J) !
pass
else Eton »
fefo
tf Convert > 1):
aelurn False
fiat
Jett
iE Ccournt 22)?
ge xreturen Tarue‘
\ oudpub s—
Enter first stot 9 cc
nikem
Enter second Stotay 1
milin :
aon ©
stotays are witoaky equal 2
\7ENGINEERING COLLEGE, aIMER
Date : Page No ...2S...
Name! sssnsnnnnnnmnmnitensieneennnss CIBSS 2 svseeenetert GFOUP ern ROWNO. errr
cavlz Popa (enter Lest spatng i")
Sto 2 = fapuk C" Cuber econ Sotag 2 Mw)
2
iL Chovlean ):
petal" stotygs are meoly equal.)
(%
pel ““otedhge vie ciol= egzeal 1! ): Otfpap
num) = 63
mame! oF
The Lom. ts 98
icp: of. dwe mumbeu is aENGINEERING COLLEGE, AJMER
Date Page NO 26
Name $ oonnenneni 1. C188 $ neineinns GFOUP vr ROWNO. LCSD.
—@.23 | Write
& ce ie
Ans»
art ,
|code | -
3 def fodln sd)
while Cy)
tn oe eee
azehurn 2%
def Lem Cary):
Acm_= Cum 4) gtd (oe g)
artturn Lom
a mum [2 int Cimput C num) 2")
cau 2.2. jt ( tmput (“ mua. OD),
Cithe pecem. is) lem Crumt, mumo2))
pectnt Cred af foto mumbers ¢ “ged (msn) mum)
Sarg Broo
ole Ra #8QS ENGINEERING COLLEGE, AJMER
Page No pen
eng erate arate ees Pas eae oe at eg
—4 24 | ° 2 e 2
Ame
a
fade —
os ako a Lp
pba CU Ende toe elements off Lit")
lev tm ange Co,nf * a
dle = fat Cinpaf (2)
amydist append Cele)
priut C" dnt iss ogy bit)
\
ded antag Set (om eS
tf ‘Ten Cry lst) >4 >
& amid = len Cry lik) // 2
Left = amy txt Cimid’]
oO
right = cen dick Cmid : J
atitageS oat eft)
an Lage Sack Cori'g ht)
jzo
o
ie fe.
20
while £2 lenCleft) and if < len (aight):
am tet CJ 2= wight jd:output t {
Erbte mumbts. a dlemed +S
exter the clement of List
as: . satiated
is
4b
38
72 sys
Apt ts! Cor,16, Hop 721:
mee seated Axt i Cis 35, 36 we, 72ENGINEERING COLLEGE, AJMER
Date : Page No.9 8
Name £1086 rena, GFOUP sn RIND, sn
ug list [el = left Ci]
pte
else
m: 1 = atyht Cid
= ftet
kee
eL= tet Cid
feel
fet =)
while jf < len Cright)!
jel
kere l
print (" fenbte. onexge orted Ant ts!" eaniggeStt mls!)
Garg BrothersENGINEERING COLLEGE, AJMER
Date : Page NO Boon
Name : sel i eaiep ne C1888 he Pans.Sroup 44: Roll NOL CSA.
Wip +o fn plement _selertin and {nsetion sort.”
Code ! = .
L=EJ
nz futl inped("trfte numba at element : "))
fiat L Meats the elements of Lad ")
itn crange(O n):
tle = ft Chapa-(1)
appurd (ele)
ptt C" Lick ist)
db celechionSenct (1)
Lee tin range (ten (4h):
for fin range (£41, len Ct)!
temp = LCiI
dCi] = £0)
ALi] = temp
poet” election sovted Art js: L)
Garg BrothersEnfer numbe of elem ts
Evie the oleminh f List
be .
cor
694
eb
69
List ts: Cassy coy, v6, ead
selection sorted A3t-'s. Cos, b& 84 22, 64)
Insation sorted LBt ts C59 68, 86,89, 94)ENGINEERING COLLEGE, AJMER
D8 | vane Page No gg.
Name rien ie son Class CSE. 37, Group £4... ROUND QLCSI}AD
det: fnseetinSev4 CL)
Lor ffm range (ten CL)):
Por o
ft oange (oe):
if C07