0% found this document useful (0 votes)
65 views

Computer Practical File

The document contains Python code for various programs including checking if a number is prime, splitting a string into characters, generating random numbers between two values, and implementing a stack using a list. It also includes code for classes to calculate the area of shapes like rectangles, squares, and triangles. The code demonstrates different Python programming concepts like functions, classes, modules, and conditional statements.

Uploaded by

vip_sotra
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)
65 views

Computer Practical File

The document contains Python code for various programs including checking if a number is prime, splitting a string into characters, generating random numbers between two values, and implementing a stack using a list. It also includes code for classes to calculate the area of shapes like rectangles, squares, and triangles. The code demonstrates different Python programming concepts like functions, classes, modules, and conditional statements.

Uploaded by

vip_sotra
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/ 5

elassMAte

Date
Page,

Snk uESTION
INDEX TEACHRSsIGNAT
Witaogfam inbrtkon to chacka.
wbe2 uchgtapr itÉspink not
w A_MOUL_divcem.bsoqscmtojid
theatea dhactangle, s9uakeAud
cincle
adm to split stingiuto chasacte
wteaphoiamLto stotudents
Lma ikaduissioMumbek
2 l unbete, AlamN aud manKs ia a
ctionatyAnd dislayeiupwmeit b N
tha asia Aadmissioi numbes
iteatucton to ga sthingmade
dil ist the chakact+ss splc
ied sthg.Ithalength q thosbina
d s th 3, theu setuthe igua
sbing
6 taprugkan to pouesatë auda
umbess Aebuten #ta6 aud check
ushatherAUMkunMLaLottosyanst
1WatapiokanZo 32ataá tbtary
nbytuo aud imhott #it ina
ph0ko
8Wita b2op£9m zr inear Brakech
1Weiteaprokas ubbl sat
oTnplemeutatin ast as stack
u wsit apropkqm Aa binak BraRck
loasate

4
Wat A ogkom in ptkean to chack-a
t i primi de nast nauber uhaE
MMnt lmput ("Estus. thanamber :")
ftin (,nam)

prit(um, ndt þprima namber


")
break
ese
parit(n4M, 1s prim.YAvmber")

HnntLAmem dbien proghamto Jind tha reo


pctangla, Aguara avnd ciile
Lde area Ls='skabo"):
isEe Squaha":
S=kt(input("eatisthe side")
A=t's
pist (A)_
elitss"uctamgle"
Eiut (iapt("estata Jangtth')
baiktjupst("eatbs ta btadt)_
A=*b
þraict (A)
elips=s "cixde":
= Mt[ibaput (eataa tha aodius))
A 3.4
pmat A_
else
rist(iuvaliek.shape"
akea("A9uar
ara ( rastngli)
area " cire
ndo charaiu
4tqs thoqtontasplit ting wret aa
Weta fvcm -to t Aring nmde 4
a
hartays a aparsed. Aoina d tas
4st
t threc
da sut (wotd) tdJ J s thom. 3 L t antthuthrn
,thon aurn e iirt
elum har far chor in ogiral irg
Wotdl= 'goudmotuungindia
brit (st (wsetd)) dat-unc0
oinpt("ertistka Aaing
b a Lo:3]
studonds inhoimákbn Je CJunla)
H Wit a Þog ew1 to stre andl c3:
nmaats
Qssiem numbe, red number, name in
rivt (a)
dicionaramd displayinormatdm on Uhe bais
ba
q else:
admission numboc
print (b)
Schav= 3
n=it(input ("te the no. destis)).
i in onge(O,n):
inbut (iti the admissiom no")
-
n=inpdt("entts the name ") We apa0famto genaratn Prdam nmbers betueil **
T= to andL heck ushthor a u u a
Lotteac not.
6

inpat("et the adl no.")


winpt["eststhe marks) impartzoudom
-list= n1,m-
Bchot [a]=_hst n=randomrandint ,6)
ue ist.(inputt(Estaanunber belur t66) D
kEschao.Eys
i in n=gusA
priut ("acdunissiovno. L) raut (Cgaataulatins, Yau unatha Lstters).
else:
V=schot C1
pist(sebord student nome [o1) parint ( Ssay Tnasain,Tke uc umbora",n)
-print (studert adlno. V [i])L
patt (studest marfs VL)
rit
elasA
elassmate
ython and
#NWait. a Þrog &onm to cheáti aibery mython amdip
i ima gtom SAsaa Clo)
#Call the wodule
Rect.ps class ectargle apanewt trtaCd squart loss by
psn
init(sel4) tIiTrianale()
t.Area (6,8 #+ Gsatt. ancbi
cbjedttfa
tja Trianglh
Priut("ectngle ") Tiar coss.
de Area(sellkgth,uidtB tCall-ta madul Aea)dTianai
Sel=hngta Ongumont class.bys
Sells width
pri(Aea 4 ectangle is seltksl Wet apkomos Linear
SPy-class Squase 2Lach
de it(sdD:-
aint square) Leal(iaput ( Eats tha olownents ")
daf Ara(sel,siela - jtam=ealLiuput(
seda Eside- Eats Hu elomeut to zeakchi)
Pamut (Aea d square isi ulhaAla) LAsi inuge (n)
#Ti.byrcdass Tiangdei C= item
daint sel4: pint(Eluunout fauud at tha basianL+)
aint riangla ") break
elap
dal Arease4baAaigt).: paiut(Elumtut fosud)
selbEbase
slhajalt
a=(Y2)*sel.b*slkh H wain a rogkamfa hubhle sst
paist ("Area d Taianale isak) LEMaliaput (*Entathe lemets "))
Emain-py
om Ahape impot Rect
oom Shale impast Sgl pin7ge (0n=):
re Shale inpantTi o1iin zanga(o,n-1):-
LC2 L[i+1:
T=ktRectangleC#Cseato. au chjet
r.Arta (Io, 20)
r
t kectanggde t=LCij
Cail the medule Areal) s Rectangle classky LL1=LLi LCit]=t
basshg arauet pziut (he satrd istis 1)
=S.zuare() #* CSeati an
cbiet sta Sguan Ctass
elassate
Dagta

#lo Tnplemetatin f ist as s r o


Iwt a Yeam for
irar ardn
Jinar- aath gequanca,
c=y
iile (==y):
Le >uB itwn,LB, UB):
r i t (" psh)
elum-5. ttri
atevalue mid=int((LB +a)
pit (2. pop) ten SeruancaLmidl:
paist ("3.isplay) etum mid
Choia=int(iat ("entir yourchoieD elil temSaupunca Inid]
choica==l)
=iaput ("eatis amy iuaoeri
Sappemd Ca) nbinant`eaach[apuuaca, itim,LB,UB).
else
elitcchoi==2 LBSmid t
s==0}:- m Binany
Seaath(cepuaa, itan,LB, UB)-
-paint ("stack enpty- LeNalCnpt (Eatry the dmauts
elssi
nalka (L) insotd oder))-
pait("deletad olemestisspop 0) Entt
elosneat=iat(iiuput (Elanssto saauh)).
el choica=3 aud= Binan Saarrh(L,elamsat,O,n-l)-
=ln (s)-
priat (sL])- paiat(elesmBatund
else
adt the index :4ound
else:
paint (weong inbtt) Print ( Elmet mot þrext mthe list").
-Cainpt (doyou uaxt to caahnue orot )

You might also like