0% found this document useful (0 votes)
18 views25 pages

Cs Practical (HHW)

Uploaded by

dakdol7567
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)
18 views25 pages

Cs Practical (HHW)

Uploaded by

dakdol7567
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/ 25

pt: In Inpt

TheUses User
fatoial

is
24.

num=03 e Wte a
elso
defactovial
Cn):
cBadprint
print Inpt)
xtaxn n==1:
(iT
1
factoaial ntfatosi
to
al fod
(n-))
Faosial
O
is
1")
o PAGE DATE

Numhes.
DATE
PAGE

Ote a hogor) to enter


etex num bex oß temd and to
bon acci sexies,

No o terms: lo
Fbonacer sguonce 3

printe'plnse Enter a lositive Numbey ")


point Abonaco seLena uto" tesms, N:")
13 poit Cn2)
21 ebo:
34 poist CEiboaca Seaconco ")

nth=n1tn2
n=n2

Coutt +1
Krogzam DATE
PAGE

numbers fsem the


gven ist.
L-212,5 o,s,23J
Tho Dic oes semo vim al even ro s as loo:
Lts,1s23] ifi2==0:
LoremoveCi)
pxistCL)
DATE
Psogyam DATE
PAGE

Odpat:
Total Vouas in fo:l6
#Woite a

Ohaactess,
T6al CoroHant infu: 30
Total Gptal ittes in foi3 K=open"lo txt")
Total anoll texs in u:4
Total ottoy otteys : C=O
U=0

data sedC)
o ch in dat:
ch bwerC) in vouls
yt=
elso:
ct=

eu chilouta)i
lt=l
eli chl=and chl=\ns
Ot=1

byist Total Small otters in "


Lit(Total atkus thon 0steS
DATE
PAGE

Wnite a pogxam to ead he contest o tle ine


Oatput:
1ojern(le1t")

i6a' not in oin:

1coeC)
2cleseC)
Hou mn rCtor at to ote : 2
Ertes nisio Nam bex loo
Ester Rell bex :~9
Entex Na 6 Rombh whie Cien):
Entex Admsci Nan be lol Adm tGinput CMertex Admission nunbert)
e t t pt potex Roll rumhes ))
nter foll number 49 nan=inpt"Ente Narn 2)
Stex NarMahsh pexc= ot Copat c"&ster Pexcestasg:)
=soll, amd, pest)
Yetora LAHml=t
Roll NO Name
89 49
dmno lol : poni(AnA·mno-",i:)
Roll No Nomu X=heloxd6)
63

hintCj. nd" )
C'Nayme'1) (ec piot
NO']=ollno tRolifyec
Tyue: ohile
ie,") {-open("Studyt
dotis.
")) display: toCoast
yo
nanme ohase nool Ertes inpt no=int
=O
fpund Xoll
'seachty def
[)cose
bxeak
`Nn' in
ich
(yIN):D C°Mose chsinpt
mpCB6 pickladu
CRolo=00 Mohesh.
:") fame Entey =input
(" n
no" Rol("&rtey
l (inpat bo=iat Cy/N):y Dose'
Maesb Nan: Stes
steC): def
Studestdtas.
dat BECQen ?(y/Ny2 ?ho. poll Dos
Ertese
pickle Ramesh NamQ: Sstes
no:1 Roll Estex
noRoll i display
na and no ol any Search Noe,
HWtea
PAGE 8
DATE
DATE.
PAGE

bseak
EoFEsos
iKourc-E=0:
-closec)
togrte)
Seasc h
Roll Mo

e te():

byek
DATE
PAGE

secol==xoll go.
um=in nput C"ertez
XeCL= um
7seek(Qos)
pckdo.dunpCxec )

Cxapt
folosel)
ste)

sed)
DATE
PAGE 1L

la clie
Amgost ndom
You
Roll aeio ? ()N):N
Thank au Koling diu**
hum=xandom. ard in0,4)

num ==1:

elso

itchoinNo,
break
prit CThanay
Cl3.Tsavesal
") pit
Tru ohile
&nd
(n-),-,-): yangp in cheias9 youY Enley
4-Exit
3-Tavesa
lop 2.
t'ged point j96oco')CoRagh
choce?5 yaus nter
4-8t
3Tsavesa
==C1): (employee 2-Yop
1-Push
solay:booo Enter
sal aml,
emp=Cenpno Namr:Rarnsh &tey
Salasy:"3) Ester iap Sal= lol empno Erter
inputC'Enter Naire cha?1 your tier
Noni 4Exit
:")) Empne )cEnter itlinpet 3-Txavers
[1coployee= fo? 2.
). nam Cenpno, dclais
Outpt:
labnet to
img Baogyam Niate
heram
11
PAGE
DATE
DATE.
PAGE

pi 4. Exi+")
choice

eGcch-2):
el Cch=-3):
tsavesse()
eliCch= 4):
bxeak

píint (uTn valid choi co')


print(iti1
guen
uth
Col
elso:
break
e tbNnaCont
nd inue yto c'hes
wnitesoweord) Gcputoj. inX-
c"Gale iapt pass=
loe") er nt npt USKLi=d 12345
ooral) lol
1a" unbjitesoo
CCUsex Progm:N
open loith he
tteinate Nn and(otiy
to Yres
toYy
1234s fasoord: &iex
Dutgat: lol l:. Estes
hrogam
12
5 PAGE
DATE
(SOL ucsÚes )
Tabe DATE
PAGE
Rol) no Name Geandle Ase egartnent oA Fees
M
24/(ompuzte l449-o)-Jo 120 fo wnite SoL-Qusi floing Quortems bascd
Ank:t table?
2 M 21
Histoxy
Hind
1q48-08- 24| 0 en tho qiven
Any F 20
Bala M Nll @Witea Qucay to cxeate a hco datab alin tho nam. o
Shaan Hindi 'studests "
beepa F 14
Histoxy Avs mysql C2EATE DATABASE STUDENTS;
Dinas b M 22 Cornputes 444-02-25| 21o
23 (b/Wite a Cacxy tD Cpen tk databaue "sTUDEN TS!
Ans mysq) 0SE `TUDEN TS,
owite a Cuoy to cxeate the above tabla callsc: Dno
atabao A>mysal CREATE TABLE STO (Rollno it faimay key ane axhr
lco, Grendes varchar (3), Age it, bept yazchatcis), boA.
employee Aote , Fees int);
nospis
oation-schema oite a Qoty to list all tho exisiog database hamk.
pesmane- schemo Ans> mys> SHOw BATA BASES;
hop)
Studess Woite a
Cusaertt datab.
An mysl SHOw TABLES;
eTakeg in_studests
Worte a
|ink table.
AsINSERT INTO STO NALUES (A, Asun'M , Conpdes'1999-o1
120)3
INSERT INTO STU NALOES(2 Ankit} W, 2, Hito 1H8-03- 28
DATE
PAGE

ISERT INTO STU VAWES (3,Hou F, 20) Hindbrl2-18.


Boo)i
rNSE RT INTO STU VAWES (4 RalsI9, NULL, 44r09-01 Yoo)
Fees IN SERT INTO STU VALOES C6 hogan M, B Hind,a9?-06-27 2S)
Roll no Nare Gorde Agg beet iNSERT INTO STU VALUES (S becpa E A HSoy, 1984-06-2a 3
(ompiter1494-0|-lo 120
ictooy (998-08-2420 INSERT INTO STU VALUES(Usha'F23,N99-0?-8), 2
Hindi 1996-12-)2
Anu
M Nl 1999-04-0| LOte a fab
Chasan Hindi | 9 -o6-2? 250
(9 Histoxy444-06-24 Ans9 mysal> SELECT* ROMSIO;
|bena 22 Commgter(944-02- 2s20
23
8 fsem STO Tato,
Ans mgsal SELECT RoL NO, NAME DEPT FROM STO
DATE.

Fees Proqza PAGE

Roll no Nao Gtundey Ag Dept |942-0|-lo 120 bas


Aun M 29 Com Hicoy 98-O3 -24 o To cosite ser Quoues fpx he follouing qusstion
Akit 3oD given tablo:
Hind' 194612 -)2
2
20
Anu is 8
14 Null
18iot A99-09-oS 2so (a Wite a usuy do dalote ho dotails of Rol) no.
Chaxoan M myslDELETEU FROM STU wHERE POLNO=8:
14 Histoxy /44- 06-22
Deepa F 144-02 -2s
23
(opter
22 N (949-ot-8) 20D G0ste a Qusy to choo the ecsof studote to 110
tls ha
Table Aume 0DATE STO FEES=190 wHOSE Ro1l NO =1 AnD
FEESA 130;
Rol no- Nano Gunde Agg Dept
j994-O1-lo
Fees ad
Owrte a Qusy toSTU. a
column Auea of type
gda
2Comp 190
Naxchar in table
ngsql ALTER T ABLE S TO AUD APGA VARHAR(20);
vous aBfected
uy Ok , 0Duplicate:0
Roco:0 Wte a
Axea ortains N,00.
Nam
frun
As musady SELECT NAME FROM STO OHERE AREA IS NOLS
Ankit
Any
Ba
O0te a Qusy do dalote Axea Calumn fem the Table.
Chara TABLE STU DROP AeEÂ?
Deepa
AWate a Qucouy to celote tableom Data bale.
DATE
PAGE 9

(it fia Stockdate


Pno nan lo
102 262-02-3)
1S 20010l-01 Tables:
S2 n l lol l2s 2021-02 -18 given
20 20-01-o) tho total Uuit paca
Sst Sale
Soo J02 20 D20-03-)4 To deplay|02.
Eraser
Q02012--04 bodeas
SooY Sharpex 102
160 2002-0| -14 Ars>mysal> SELECT SumCUNITRRICE) FRoM GTOCK
HAVINGAb CobE =lo2;
Tablo: bEALERS
bnan
Sakthi Stotionues
A> mygl SE LEC* FpOM STOCK ORDER BY SToCK bATE DESC;
102 e Inolian Beok Heuse
Classe Stotionoies OTo cliplay antt

Otpi: Arg>nqlSELECT D(ODE, MAXCUNITPRLCE) FROM STo(k GROu


@SucuNITPRICE)
33

bcobE NA CUHITPRICE)
lo2 A>mysalsEcT PNAME,DNAME FROM STocKS,DEALERsb
(o\ 6

) PNAME DNAME
Indian Boot Ho
koaser Sattni Stetioojes
Venl
Gul Pe Premium Inoian Book tCu
SraspneA Indian ook Hous
Bal pol) Pen Book Hout
Scals
Cnae pen clasic Sotthtotioiee
CQossic etot'onja.
Pathon Databat Conmneetit DATE

16 PAGE 20

wth databas0 aund store recor d


Rroram to Connbat
enpbfe and dialay
1-REcORd ADD
2- DISPLAY RECORD ny con
ocalst'
O.EXIT
ENTER c h o i a u h h ton= mycn conneatC hcst=
passond= ost")
Ektes opoee No : lo Cu Con. CuxsoyC)
Ertey Nm:'Raesh
databass i
Cur. exxeodeC"Caaie
no exists (ompen "
Estes Sala 34000 cux-exeuR C Ca compony
exeoate ("Crede tab' i n ext employe( em poo int
nam Norchorl20), dei vaxchas (a0, Salasy int
1-Pecoxd AA (Con tommitC)
2-Bisplay Racevcs lchojcl= =NonQ
ohilo choiceJ=0:
O.6xit
Enter choie: 2
EMPNO NAME SALARy
DE PARTNENT Rotord)
lo) Rash 1184000 phintC'.6xit
Ahoia =int ingat C"Enter choica"))
4 Recod Ad
2 Bisplay ecosd e=itCin padt ("erntex Em ployec No."))
06xit
Enes chex(a:O

famat le,nyda)
DATE
PAGE 21

piot(+t DATA SAVED +#)


eli coico=2:
qusy
ekeuteCquy)
yivt c Ioc"EMRNO" ). 206"1. NAMES
DEPARTMENT"los" 1" Salaty")
in xeslt
pintcy las' . Xo> le],'" y2os" os(144Srcal

Con.closer)
DATE
PAGE

sgevois (Onsei Updote, belte, bisplag


MENU
1. lnsest Record Connecivity
Updote eateyd Jb ms.connChost=localhost',
3-Debte Racord
4: bisplay Pacoxd
S- Exit
Eter you choid<i-5= 1 dolabal ='classxii
Estes Yoll number: 1
Erter nome: Aysb
Evtex Masts: 5 det insest-sec

Reccad lnserted neit (inps CEntes xol numbex)


Sn= nput Cente nanm:"
MENU mnfuot (in pat cuentes mostar"))
4. Insest Recod qn=inptErtes Grado
3 Delte ecos sma (rn, sn, mn,gn)")
u. Bisplay Rotoyd Ab CommitC)
5- Ext ch=inp ("Want mexe secosda? Pmess (Nn)to stop
Enhes gous ohoi Q<2s>= if ch in'Nn
Reoad doloted pait c"Recoscd loseted )
break
nsert exeet Explen
pzinlBso"e

Erter our ho ig1-6>=5


A0D DATE,
PAGE 3

def upolate-ec):
h-ist Ciogut(v Entes xoll no. too upclate :"))
mn =

qninptCEntex no qocle :")


cn.Exeute(updae studest set
db commto
pxitCRecosd Updated..")
exap0 Exupion as e
point C'Eo',e
dek doloteec(3:
nintCinpt Erstes oll no. to clalote ")D
Ca exeate C"dolote Brcm stuclent wheo m-3 omatn)
db Commitc

execg ExCophon ase


oi(Extes,e)
Seß disp)ay=vec)i
gecordh =cntcha
pint Coetond)
DATE
PAGE 4

exapl Ex aphon os ei
Ab ms Cood Chost = atal hot"

Aatabas- clasS-Xii

poit("ENU\n 1-Jnsest Recond\n2-Upclote kecosd \n3.Delate


Rocord \n9. Display Recerd \n SExi t

insest ecoC)
e ch==2:
update-zec)
Jalste-ec)
diclay-ec)
brak
els!
AO, DATE

Psogam PAGE,

+ Psogtom to Comnas toith datab al and Seaxch enoyee nugabek


EMPLOYEE SEARCHINGG FoR in able empleyee od display xecorcde ig empna"nt funs
ENTER EMNO TO SEARCH |
NAME DEPARTMENT SALARY
3400D injort
Con= hmyon connod Choct=loalhast
lol 1T
SEARcH MORE CY): uJs=root,
pa=oot
dotba (om pong)
Pot EMRLOYEE SEARCHIN G FoRM)

xeute (ausu
casyo Count==0:

bERARTMENT, 1.10s"." SA LA RY )

You might also like