0% found this document useful (0 votes)
88 views45 pages

APP Lab Manual

Uploaded by

neekenduku58
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)
88 views45 pages

APP Lab Manual

Uploaded by

neekenduku58
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/ 45

R20

I
nfo
rma
tio
nTe
chn
olo
gy

Ob
jec
ti
ve:
Th
est
ude
nts
hou
ldb
eab
let
o
VAS
IREDDYVENKATADRII
NSTI
TUTEOFTECHNOLOGY
1. Ab
letNl
o A
eM
aB
nU
r R
a U(
dvan
cV
e)
,P
dcoE
nD
cA
e
pK
tsA
iKA
nPN
ytI
h(
o
nM),GUNTURDT–522508
2.AbletouseadvTe
a
nl
cN
e o
:
dp0
ac8
6
k
ag3
e-
21
sl1
i9
k
e78
n2
u
m,u
p
yr
,l
:
sw
cw
i
pyw
,.
v
ov
i
p
et
ng
u
c
vnt
u
i
nr.
c
Po
ym
t
honf
orb
uil
din
gda
ta
pr
oce
ssi
ng&v iA
sp
u
ap
lr
io
v
zie
ndb
ga pyA
pl
iI
cC
a
tT
io
nEa
s.ndA ffi
li
ate
dt oJNTUK
3.Abletoproc
essdigi
talimagi
nga p
pli
cat
io
ns

PRE-
REQUI
SITES
:
 Fu
ndame
nta
lsofPyth
on
 Pr
obl
emsol
vi
ngski
ll
s

Co
urs
eob
jec
ti
ves
:Th
est
ude
nts
hou
ldb
eab
let
o

ADVANCEDPYTHONPROGRAMMI
4.Ab
l
5.Ab
l
et
et
ol
ou
e
s
a
rna
ea
dv
dva
a
n
c
n
e
ce
dc
dp a
c
o
n
k
c
a
e
p
g
e
NG
tsi
sli
nPy
k
en
t
u
h
mp
o
n
y,s
ci
py,o
pen
cvi
nPy
tho
nfo
rbu
il
din
gda
ta
pr
oce
ssi
ng&v i
sua
lizi
ngappl
ica
tio
ns.
6.Ab
letopro
ces
sdigita
limagi
nga p
pli
cat
io
ns

Un
it-
1:Py
tho
nFu
nda
men
tal
s:I
ntr
o LABMANUAL
du
cti
ont
oPy
tho
n,Da
taS
tru
ctu
res–Li
st
,Di
ct
io
nari
es,Se
tsa
nd
Tu
ples
. (
6h rs
)

Modul
es,PythonPacka
ge s
,Libr
a r
ies
:Mo du
les-Creat
ingmodule
s,impor
tstat
ement
,fr
omI mpor
t
s
tate
ment,namespaci
ng.Ma tI
hMI-I
o
duB
l-
eT
:Ce
oc
n
sh(
tan
tI
sT
,)
Po
wera n
dl og
ari
thmicfun
cti
ons
,Tri
gon
ometri
c
fu
nct
ion
s.Nu mpy Li
brary:NDue
mp
pa
yrt
im
mpe
on
r
tto
,B f
as
iI
cTfun
cti
ons
,Ma tr
ic
es Addit
ion
,Subtr
a c
ti
on
Mult
ipl
ica
tio
n,Trans
pose,In
vers
e,Eigenval
uesandEigen
vect
orsusi
ngNu mp
y( 8
hrs)

Un
it-
2:Pyt
honp
ack
age
s:I
ntr
odu
cti
ont
oPI
P,I
nst
all
in
g Pa
cka
gesv
ia PI
P,Us
ing Pyt
hon
Pa
ckage
s (4h
rs)

Dat
aVi s
ual
izat
ion–Matpl
ot
li
b-Loa
din
gt h
eli
bra
ryan
di mpo
rti
ngthedat
a,Ho
wMatpl
otli
b
wor
ks?
,modifyi
ngtheapp
ear
anc
eofap l
ot
,Plo
tti
ngmul
ti
pleplo
ts,Modi
fyi
ngt
het
ic
kma r
ks,
Sc
att
erplo
ts,Barpl
ot
s. (8
hrs
)

Uni
t-
3:Fi
leHandl
in
g–I nt
rodu
cti
ontoFil
es,Fil
emodes
,Readi
ng,Wri
ti
ngda
taf
romf
il
es,Cop
y
on
efil
etoano
ther
,del
eti
onoffil
es.Ot
herfil
eprog
rams i
nPython
. (
4hrs
)

Te
xtPro
ces
si
ng:Wor
d,cha
rac
terandli
nec
oun
tin
g,Fr
equ
enc
yco
unt
.Us
ageo
fwi
th(
)andspl
it
()
.
Re
adi
ngandwri
ti
ngi
ntoCSVforma
ts. (
8hr
s)

Uni
t-4:ImageProc
ess
ing-I n
sta
ll
ingJ
upi
ternot
ebo
ok.I
mag
e&I t
sp r
ope
rti
es.Ima
geproc
ess
ing
ap
plica
tio
ns.I
mageI/Oa n
ddi s
pla
ywit
hPy th
on,Rea
din
g,s
avi
ngan
ddi s
pla
yinganima
geu s
ing
OpenCV-Py PI
,matpl
otl
ib

S
amp
lep
rog
rams–I
mag
est
ati
st
ic
sCr
opi
ng,Co
nve
rti
ngi
mag
esf
romRGBt
oGr
aya
ndr
esi
zin
g
I
nfo
rma
tio
nTe
chn
olo
gy
t
hei
mag
e. (
12h
rs)

Uni
t-
5:Us
ingDatab
ase
sandSQL–I nt
roduc
tio
ntoDat
abas
eConc
ept
s,usa
geofSQLi
te,Cr
eat
e,
In
ser
t&Retri
evedat
a,Sp
ide
rin
gtwi
tt
eru s
ingadat
aba
se.S
amp
lePytho
ncode
s(8hrs
)

Te
xtb
ook
s:
1. Py
tho
nforEver
ybo
dy:Exp
lor
ingDat
aUs i
ngPyth
on3 ,Ch
arl
esS
eve
ran
ce
2.TheHitc
hik
er’
sGu i
detoPython
,O’Re
il
lypub
li
cati
on
Re
fer
enc
ebo
oks
:
1. Ha
nds-
OnImag
eProc
ess
ingwit
hPy t
hon
,O’Re
il
lyPu
bli
cat
io
ns
2. Th
inkPyt
hon
,All
enDowney
,Gree
nTe aPr
ess
e
-Re
sou
rce
s&o
the
rdi
git
alma
teria
l
1.ht
tps
:/
/np
tel
.
ac.
in/
cou
rse
s/11
7/105/
1171
05079/
2.htt
ps:
//
npt
el.
ac
.i
n/c
our
ses
/106/1
06/1061
06145/#
3
.ht
tps
:/
/re
alp
yth
on.
co
m/p
yth
on-
mys
ql/

Cou
rseOutc
ome
s:Uponsucc
essf
ulc
omp
let
io
noft
hec
our
se,t
hes
tude
ntwi
llb
eab
let
o
CO1
:Re
cal
lth
eu s
ageo
fPyt
honCon
cep
ts.
CO2:Us
edi
ffe
ren
tPy
tho
npa
cka
gesf
orDa
taVi
sua
li
zat
io
n
CO3
:De
mon
str
ateFi
leh
andl
in
g&t
extp
roc
ess
ing
CO4:De
mon
str
atea
ppl
ic
ati
onst
hatp
erf
ormsI
mag
epr
oce
ssi
ng
CO5:Co
nne
ctda
tab
asewi
thPy
tho
n.

Te
xtb
ook
s:
1.Py
tho
nforEve
ryb
ody:Exp
lor
ingDat
aUs i
ngPyth
on3 ,Ch
arl
esS
eve
ran
ce
2.Th
eHitc
hik
er’
sGuidetoPython
,O’Re
il
lypub
li
cati
on
Re
fer
enc
ebo
oks
:

1. Ha
nds-
OnImag
eProc
ess
ingwit
hPy t
hon
,O’Re
il
lyPu
bli
cat
io
ns
2.ThinkPyt
hon
,All
enDowney
,Gree
nTe aPr
ess
Di
git
alr
eso
urc
es:
1.h
ttps
:/
/npt
el.
ac
.i
n/c
our
ses
/117/
105/
117
105079/
2.http
s:
//np
tel
.a
c.
in/
cour
ses
/106/
106/
1061061
45/#
3
.ht
tps
:/
/re
alp
yth
on.
co
m/p
yth
on-
mysql
/

Co
urs
eOu
tco
mes
:
CO1: Re
cal
ltheusag
eo fPythonConc
ept
s.
CO2: Us
edi f
fer
entPythonpackage
sf o
rDa t
aVi s
uali
zati
on
CO3: Demo
nst
rat
eFilehandl
ing&t ex
tproc
ess
ing
CO4: Demo
nst
rat
eappli
cat
ion
st ha
tp e
rfo
rmsImagepro
ces
si
ng
CO5: Co
nnec
tdatab
asewithPython.
I
nfo
rma
tio
nTe
chn
olo
gy

CO-
POma
ppi
ngTa
ble
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO1
0 PO1
1 PO1
2 PSO-
1 PS
O-2

CO1 1 1 1 2
CO2 1 2 2 2
CO3 1 2 2 2
CO4 2 2 2 2
CO5 1 2 2 1

Re
comme
nde
dSy
ste
ms/
Sof
twa
reRe
qui
reme
nts
:

·I
nte
lbase
ddes
kto
pPCwi
thmin
imu
mof166MHZorfa
ste
rpr
oce
sso
r
wi
thatl
eas
t64MBRAM a
nd100MBfre
edis
ksp
ace

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
La
bEx
per
ime
nts
:

1
. Writ
eap rogr
amtoch
eckwhe
thert
h egi
vensen
ten
ceco
nsi
st
sofallvowel
sornot
.
Her
ea r
es o
me ofthe wor
ds: EDUCATI
ON, AUTOMOBILE, EVACUATI
ON,
REMUNERATION
REGULATION.

2.Wri
teapro
gramtofindouttheli
stth
ewo rdstha
tc anbefor
medwit
ht h
elett
ers
'
A'
,'K'
,'E'
,'O'
,'
T','
P','N'
.fro
mt hegive
nl i
stofwo r
ds.Aru
n,Var
un,Kent
,Eat,
Po
t,ne
t,Pe
ak,Peaco
ck,Zeb
ra,Nat
o,Toe,Poke,Kni
fe,Peot
,Venu
s,Ant
.

3
.Th e
reisac o
ll
ect
io
nofFi
veEmpl
oye
esdatawi
thid,name
,b a
sics
ala
rywi
th
a
ll
owanc
es(
TA,DA,HRA,a
ndbon
us)
,numb
erofyea
rsex
peri
enc
e. Ev
alua
tet
he
f
oll
owi
ngda
ta:

 di splaya l
le mployeen ame sandt heirnets alar
ies
 di splaye mp loyeen amewi thh ighest&l owests al
ary.
 di splayt hea ve
rag es al
ary.
Note:Nob onusf ore mp l
oyeeswi thl essthan2y earsofe xperie
nce.
4.Wr i
teaPy thonp rogramt os ortt hen amesinadi cti
onaryb asedonac harac
terat
rd
part
icul
arp ositi
ono ft hen ame .Eg :{1:
”Ra ma”,2: ”Raju”,3:
”Ra vi
”}Ifp osi
ti
on=3 ,
out
p ut
=[“Ra ju”,“Ra ma”,”Ra vi
”}
5.Wr i
teap rogramt oc ountt hen umbe r
so fc har
actersint hes t
ringands t
orethemin
adi c
tio
na ryda tas tr
u c
ture
6.De mo n
stratema tr
ixa dditio
n ,mu l
tipl
icati
ono fanyt woma tr
icesusi
ngnumpy.
7.Wr i
teaPy thonp rogramt oc o
mp utet hee i
genv aluesandr ighte i
genvecto
rsofa
giv
ens quarea rray.
8.Wr i
teaNu mpyp rogramt os wa prowsa n dcolu
mn so fag ivena r
rayinrever
seorder
.
9.De mo n
stratet hec a rs a
leso fas howr oomdu ri
ngt hel as
t6mo nthswiththeh e
lpof
barchart.(Us ema tplot
lib)de monstr
ate
10.Demo n
stratet hep assp ercentageo fstude n
tsjoinedi n201 9-20a ca
demicy e
arinI-
IIsemesterwi tht h eh elpo fb archa r
t,p i
ec har
t,sc at
terp l
ot.
11.Findoutn u mbero fl ines,wo rds,character
si nag ivent e
xtf il
e.
12.Accumul
a tea llwo rdsi ntot her espe
ctivea l
phabetbu ck
etsf ro
mt heg i
ventextfil
e.
13.Wr i
teaPa ndasp rog ra
mt oc re
atea nddi spl
ayaDa ta
Fra mef r
omas peci
fied
dic
tiona
ryda tawh ichh ast hei ndexl abel
s.
SamplePy th ondic tio
n a
ryda taa ndl i
stlabels
:
exam_data={ 'name ':['
An astasi
a','Dima','Katheri
ne '
,'James'
,'Emily'
,'Mich
ael'
,
'
Ma tthe
w' ,'La ura','Ke vi
n','Jonas'
],
'
score'
:[12.5,9,1 6.5,n p.
nan,9,20,1 4.5,np.na
n,8 ,19],
'
attempts'
:[ 1,3 ,2,3 ,2,3 ,1 ,1,2,1 ],
'
qualif
y':['yes','no','yes'
,'no','no'
,'yes'
,'yes'
,'no'
,' no
','yes
']}

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
la
bels=[ '
a','b','c'
,' d','e
','f
','
g '
,'h','i
','j'
]
Expect
e dOu tput:
atte
mp tsn ameq u
a li
fys c
ore
a1An a stas
iay es1 2.5
b3Di man o9. 0
.
..
.i2Ke vi
nn o8 .
0
j1J onasy es1 9.0
14.Wr i
teaPa ndasp rog ramt osel
ectt herowswh eren umberofatte
mp t
sint he
examin
a ti
oni sl esst han2a ndscoreg reaterth an15.
SamplePy t
h ondi ctio
n arydataan dlistlabels:
exam_data={ 'name ':['Anast
asi
a','Dima','Ka t
h eri
ne'
,'James'
,'Emil
y','
Michael
',
'
Ma tthew','La ura','Ke vin
','J
onas'
],
'
score
':[12.5,9,1 6.5,n p.
nan,9,20,1 4.5,n p.
nan,8,1 9]
,
'
attempts':[1,3 ,2,3 ,2,3 ,1,1,2,1 ],
'
quali
fy '
:['yes','no','yes'
,'no'
,'no'
,'yes'
,'yes','no'
,'no'
,'yes
']
}
la
bels=[ '
a','b','c'
,' d','e
','f
','
g '
,labels=[ 'a','b
','c'
,'d'
,'e'
,'f
','g
','h
','i
','
j']
Expect
e dOu tput:
Numb e
ro fa tt
emp tsi nt heexaminatio
ni slesst han2a ndscor
eg r
eaterthan15:
names corea tt
e mptsq ual
ify
jJ o
nas1 9.01y e
s
15.Wr i
teaPy thonp rogramt oc o
nvertRGBt og r
ays cal
ea nda l
sodispl
ayinfor
ma t
io
n
ofthei ma ge
16.Wr i
teaPy thonp rogramt or e
ada nddi splayi mage
17.Wr i
teaPy thonp rogramt ode mons
trateda tabaseo pera
tion
ssucha scre
ate,ins
ert
,
sel
ecta nd,u pda t
e
18.Wr i
teaPy thonp rogramt odi s
playt hefollowing
A)Di s
p l
aye mployeej o
inedint heg i
veny ear
B)Di s
p l
ayt hema n agerwi thhighestsalary
C)Di s
p l
ayt hede p artmentwithh i
g ha ver
a ges al
ary
19.Wr i
teaPy thonp rogramt op er
formt hef oll
owin g
A)Di s
p l
ayt h ee mp lo
y eenamesth atbe g
inwi thg ivenlette
r
B)Di s
p l
ayt hes ortedl is
to femployeen ames
C)Di s
p l
ayt hee mp lo
y eesjoi
nedb etweent heg ivenda t
es
20.Wr i
tesPy th onp rogramt or e
adda taf romTwi tte
ra nddi s
pla
yt hedata

LABEXPERI
MENT :1

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
AI
M:Wr
it
eap
rog
ramt
och
eckwh
eth
ert
heg
ive
nse
nte
ncec
ons
is
tso
fal
lvo
wel
sor
n
ot.He
rea
res
omeo
fth
ewo
rds
:EDUCATI
ON,AUTOMOBI
LE,EVACUATI
ON,
REMUNERATI
ON,REGULATI
ON.

DES
CRI
PTI
ON:

Fi
rs
tl
y,c
rea
tes
eto
fvo
wel
sus
ings
et(
)fu
nct
io
n.Ch
eckf
ore
ach
c
har
act
ero
fth
est
ri
ngi
svo
welo
rno
t,i
fvo
welt
hena
ddi
ntot
hes
ets
.
Af
terc
omi
ngo
uto
fth
elo
op,c
hec
kle
ngt
hoft
hes
ets
,ifl
eng
tho
fse
t
si
seq
ualt
oth
ele
ngt
hoft
hev
owe
lss
ett
hens
tri
ngi
sac
cep
ted
o
the
rwi
sen
ot.

PROGRAM:

s
ent
enc
e=i
npu
t("
Ent
ers
ent
enc
e")
v
owe
l=[
'a
',
'e
',
'i
',
'
o',
'
u']
c
nt=
0
f
orii
nst
r(
vowe
l)
.l
owe
r()
:
i
fii
nse
nte
nce
:
c
nt+
=1
i
fcn
t==
5:
p
rin
t("
Allv
owe
lse
xis
ting
ive
nse
nte
nce
")
e
lse
:
p
rin
t("
Allv
owe
lsdon
ote
xis
t"
)

OUTPUT:
En
ters
ent
enc
ehe
ll
o

Al
lvo
wel
sdon
ote
xis
t

LABEXPERI
MENT :2
AI
M:Wr
it
eap
rog
ramt
ofi
ndo
utt
hel
is
tth
ewo
rdst
hatc
anb
efo
rme
dwi
tht
he

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
l
ett
ers'
A'
,'K'
,'E'
,'O'
,
'T'
,'P'
,'N'
.fr
omt
heg
ive
nli
sto
fwo
rds
.Ar
un,Va
run
,Ke
nt,
Ea
t,Po
t,n
et,Pe
ak,Pe
aco
ck,Ze
bra
,Na
to,To
e,Po
ke,Kn
ife
,Pe
ot,Ve
nus
,An
t.

DES
CRI
PTI
ON:

Py
tho
nLi
st
sar
eju
stl
ik
edy
nami
cal
lys
ize
dar
ray
s,de
cla
redi
not
herl
ang
uag
es
(
vec
tori
nC+
+an
dAr
ray
Lis
tinJ
ava
).I
nsi
mpl
ela
ngu
age
,al
is
tisac
ol
le
cti
ono
f
t
hin
gs,e
ncl
os
edi
n[]a
nds
epa
rat
edb
yco
mma
s.

PROGRAM:

n
ame
s=[
'Ar
un'
,'Va
run
','
Ken
t'
,'Ea
t','
Pot
','
net
','
Pea
k','
Pea
coc
k','
Zeb
ra'
,'Na
to'
,
'
Toe
','
Pok
e','
Kni
fe'
,'Pe
ot'
,'Ve
nus
','
Ant
']
l
ett
ers=[
'A'
,'K'
,'E'
,'O'
,
'T'
,'P'
,'N'
]
f
orn
amei
nna
mes
:
c
nt=
0
u
ni=l
is
t(s
et(
name
.up
per
()
))
f
orl
ett
eri
nun
i:
i
fle
tte
rinl
ett
ers
:
c
nt+
=1
i
fcn
t==
len
(na
me)
:
p
rin
t(n
ame
)

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
OUTPUT:
Ke
nt
Ea
t
Po
t
n
et
Pe
ak
Na
to
To
e
Po
ke
Pe
ot
An
t

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
EXPERI
MENT :3
AI
M:Th
erei
sac
ol
le
cti
ono
fFi
veEmp
loy
eesda
tawi
thi
d,n
ame
,ba
sics
ala
rywi
th
a
ll
owa
nce
s(TA,DA,HRA,a
ndb
onu
s),n
umb
ero
fye
arse
xpe
rie
nce
. Ev
alu
atet
he
f
oll
owi
ngda
ta:

 di
spl
aya
lle
mpl
oye
ena
mesa
ndt
hei
rne
tsa
lar
ies
 di
spl
aye
mpl
oye
ena
mewi
thh
igh
est&l
owe
sts
ala
ry.
 di
spl
ayt
hea
ver
ages
ala
ry.
No
te:Nob
onu
sfo
remp
loy
eeswi
thl
esst
han2y
ear
sofe
xpe
rie
nce
.
DES
CRI
PTI
ON:
Gi
vena
nin
teg
erb
asi
can
dac
har
act
erg
radewh
ichde
not
est
heb
asi
csa
lar
yan
d
g
radeo
fap
ers
onr
esp
ect
ive
ly,t
het
aski
stof
indt
heg
ros
ssa
lar
yoft
hep
ers
on.
Gr
ossS
ala
ry:Th
efi
nals
ala
ryc
omp
ute
daf
tert
hea
ddi
ti
onso
fDA,HRAa
ndo
the
r
a
ll
owa
nce
s.
Th
eide
aist
ofi
ndt
hea
ll
owa
nceo
nth
eba
siso
fth
egr
adea
ndt
henc
omp
utet
he
HRA,DA,a
ndPFo
nth
eba
siso
fth
eba
sics
ala
ry.Be
lowi
sth
eil
lu
str
ati
ono
fth
e
c
omp
uta
tio
nofHRA,DA,a
ndPF.

PROGRAM:

de
fco
mpu
teS
ala
ry(b
asi
c,g
rade
):

h
ra=0.
2*b
asi
c
da=0.
5*b
asi
c
p
f=0.
11*b
asi
c

#Co
ndi
ti
ont
oco
mpu
tet
he

#a
ll
owa
ncef
ort
hep
ers
on
i
fgr
ade=
='A'
:
a
ll
owa
nce=1
700.
0

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
e
li
fgr
ade=
='B'
:
a
ll
owa
nce=1
500.
0
e
lse
:
a
ll
owa
nce=1
300.
0;

g
ros
s=r
oun
d(b
asi
c+h
ra+da+
all
owa
nce-p
f)

r
etu
rng
ros
s

#Dr
ive
rco
de
i
f__
name
__=
='_
_ma
in_
_':

b
asi
c=1
0000
g
rade='
A'

#Fu
nct
io
nca
ll
p
rin
t(c
omp
ute
Sal
ary
(ba
sic
,gr
ade
))
;

OUTPUT:

1
7600

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
EXPERI
MENT4:
AI
M:Wr
it
eaPy
tho
npr
ogr
amt
oso
rtt
hen
ame
sinadi
ct
io
nar
yba
sedo
na
c
har
act
era
tpa
rti
cul
arp
osi
ti
ono
fth
ena
me.Eg
:{1
:”Ra
ma”,2:
”Ra
ju”,
3:
”Ra
vi”}I
f
rd
p
osi
ti
on=
3 ,o
utp
ut=
[“Ra
ju”,“Ra
ma”,
”Ra
vi”}
DES
CRI
PTI
ON:

Cr
eat
ingadi
ct
io
nar
yisa
ssi
mpl
easp
lac
ingi
temsi
nsi
dec
url
ybr
ace
s{}s
epa
rat
ed
b
yco
mma
s.Ani
temh
asakeya
ndac
orr
esp
ondi
ngval
uet
hati
sex
pre
sse
dasap
air
(
key
:va
lue
).Wh
ilet
hev
alu
esc
anb
eofa
nyda
tat
ypea
ndc
anr
epe
at,k
eysmu
stb
e
o
fimmu
tab
let
ype(
st
ri
ng,n
umb
ero
rtu
plewi
thi
mmu
tab
lee
leme
nts
)an
dmu
stb
e
un
iqu
e.
PROGRAM:
n
ame
s={
}
n=i
nt(
in
put
('
Ent
ern
umb
ero
fna
mes
')
)
f
orii
nqr
ang
e(n
):
n
ame
s[i
+1]
=in
put
('
Ent
eran
ame
')
n
ame=l
is
t(n
ame
s.
va
lue
s()
)
p
os=i
nt(
in
put
('
Ent
erp
osi
ti
on'
)
)
n
ame
.s
ort
(ke
y=l
amb
dax
:x[
pos
])
p
rin
t(n
ame
)

OUTPUT:
En
tern
umb
ero
fna
mes
3
En
teran
ame
WELCOME
En
teran
ame
HELLO
En
teran
ame
HAI
En
terp
osi
ti
on2
[
'HAI
','
WELCOME'
,'HELLO'
]

EXPERI
MENT5:
AI
M:Wr
it
eap
rog
ramt
oco
untt
hen
umb
erso
fch
ara
cte
rsi
nth
est
ri
nga
nds
tor
e

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
t
hemi
nadi
ct
io
nar
yda
tas
tru
ctu
re
DES
CRI
PTI
ON:
Py
tho
nDi
cti
ona
ryi
sli
keama
pth
ati
sus
edt
ost
oreda
tai
nth
e
f
ormo
fak
ey:
val
uep
air
.
c
lea
r()
-Re
mov
esa
lli
temsf
romt
hedi
cti
ona
ry
c
opy
()Re
- t
urn
sas
hal
lo
wco
pyo
fth
edi
cti
ona
ry
f
romk
eys
()
-Cr
eat
esadi
cti
ona
ryf
romt
heg
ive
nse
que
nce
g
et(
)Re
- t
urn
sth
eva
luef
ort
heg
ive
nke
y
i
tems
()
-Re
tur
nth
eli
stwi
tha
lldi
cti
ona
ryk
eyswi
thv
alu
es
k
eys
()
-Re
tur
nsa v
iewo
bje
ctt
hatdi
spl
aysa l
is
tofa
llt
hek
eysi
nth
e
di
cti
ona
ryi
nor
dero
fin
ser
ti
on
v
alu
es(
)Re
- t
urn
sal
is
tofa
llt
hev
alu
esa
vai
lab
lei
nag
ive
ndi
cti
ona
ry
PROGRAM:
s
=in
put
('
Ent
eras
tri
ng'
)
d=
{}
i
fs.
i
ssp
ace
()
:
p
rin
t('
Str
ingi
semp
ty'
)
e
li
fs.
i
sdi
git
()
:
p
rin
t('
Ent
erc
har
act
erso
nly
')
e
lse
:
f
orii
ns:
d[
i]
=s.
co
unt
(i
)
p
rin
t(d)

OUTPUT:
En
teras
tri
ngWELCOME

{
'W'
:1,'
E':2,'
L':1
,'C'
:1,'
O':1
,'M'
:1}
EXPERI
MENT6:
AI
M:De
mon
str
atema
tri
xaddi
ti
on,mu
lti
pl
ic
ati
ono
fan
ytwoma
tri
cesu
sin
gnu
mpy
.

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
DES
CRI
PTI
ON:
Thi
scla
ssretur
nsamatr
ixfro
mast
ri
ngofda
tao
rar
ray
-li
keo
bje
ct.
Matr
ixobt
ain
edi sas
pec
ial
is
ed2Darr
ay.
Sy
ntax:
n
ump
y.ma
tri
x(da
ta,dt
ype=No
ne):
Pa
rame
ter
s:
da
ta :da
tane
edstob
ea r
ray
-li
keors
tri
ng
dt
ype:Dat
atypeo
fret
urn
eda r
ray
.

Re
tur
ns:
da
tai
nte
rpr
ete
dasama
tri
x

PROGRAM:
i
mpo
rtn
ump
yasn
p
r
ow1
,c
ol
1=l
is
t(ma
p(i
nt,
i
npu
t('
Ent
err
owa
ndc
ol
')
.
spl
it
()
))
A=
np.
ar
ray
(li
st
(ma
p(i
nt,
i
npu
t('
Ent
erma
tri
xA'
)
.s
pli
t(
))
))
A.
sh
ape
=(i
nt(
row1
),
in
t(c
ol
1)
)
p
rin
t(A)
r
ow2,
co
l2=
li
st
(ma
p(i
nt,
i
npu
t('
Ent
err
owa
ndc
ol
')
.
spl
it
()
))
B=
np.
ar
ray
(li
st
(ma
p(i
nt,
i
npu
t('
Ent
erma
tri
xB'
)
.s
pli
t(
))
))
B.
sh
ape
=(i
nt(
row2)
,
int
(co
l2)
)
p
rin
t(B)
i
f(
row1
==r
ow2a
ndc
ol
1==
col
2):
p
rin
t("
Addi
ti
on=
",
np.
add(
A,B)
)
p
rin
t("
Ele
men
tbye
leme
ntmu
lti
pl
ic
ati
on"
,n
p.
mul
ti
pl
y(A,
B))
e
lse
:

p
rin
t("
Mat
ri
cesa
ddi
ti
ona
nds
cal
armu
lti
pl
ic
ati
ona
ren
otp
oss
ibl
e"
)
i
f(
col
1==
row2)
:
p
rin
t("
Mul
ti
pl
ic
ati
on=
",
np.
dot
(A,
B))
e
lse
:
p
rin
t("
Mul
ti
pl
ic
ati
oni
sno
tpo
ssi
bl
e"
)

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
OUTPUT:
En
terr
owa
ndc
ol23
En
terma
tri
xA123456
[
[123
]
[
456]
]
En
terr
owa
ndc
ol22
En
terma
tri
xB2345
[
[23
]
[
45]
]
Ma
tri
cesa
ddi
ti
ona
nds
cal
armu
lti
pli
cat
iona
ren
otp
oss
ibl
e
Mu
lti
pli
cat
ioni
sno
tpo
ssi
bl
e

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
EXPERI
MENT7
:
AI
M:Wr
it
eaPy
tho
npr
ogr
amt
oco
mpu
tet
hee
ige
nva
lue
san
dri
ghte
ige
nve
cto
rs
o
fag
ive
nsq
uar
ear
ray
.
DES
CRI
PTI
ON:
Nu
mpyi
saPy
tho
nli
bra
rywh
ichp
rov
ide
sva
rio
usr
out
ine
sfo
rop
era
tio
ns
o
nar
ray
ssu
cha
sma
the
mat
ic
al,l
ogi
cal
,sh
apema
nip
ula
tio
nan
dma
nymo
re.
Af
terc
rea
tin
gas
qua
rema
tri
xus
ingn
ump
yli
bra
ryweh
avet
ous
ea
p
ack
agei
nth
isl
ib
rar
ykn
owna
snu
mpy
.l
in
alg
.Th
isl
ib
rar
yisu
sedf
or
c
alc
ula
tin
gal
lth
eli
nea
ral
geb
raf
unc
ti
onsl
ik
eve
cto
rpr
odu
ctsma
tri
x
o
per
ati
ons
(i
nve
rse
,tr
ans
pos
e).
PROGRAM:
i
mpo
rtn
ump
yasn
p
r
ow,
co
l=l
is
t(ma
p(i
nt,
i
npu
t('
Ent
err
owa
ndc
ol
')
.
spl
it
()
))
A=
np.
ar
ray
(li
st
(ma
p(i
nt,
i
npu
t('
Ent
erma
tri
xA'
)
.s
pli
t(
))
))
A.
sh
ape
=(i
nt(
row)
,
int
(co
l)
)
p
rin
t(A)
i
f(
row=
=co
l)
:
p
rin
t(n
p.
li
nal
g.
ei
g(A)
)
p
rin
t(n
p.
li
nal
g.
ei
gva
ls(
A))
e
lse
:
p
rin
t("
Eig
env
alu
esa
rec
alc
ula
tedo
nlyf
ors
qua
rema
tri
ces
")
OUTPUT:
En
terr
owa
ndc
ol
33
En
terma
tri
xA123804783
[
[123
]
[
804]
[
783
]]

(
arr
ay(
[1
1.
218
22293
+0.
j
,-
3.
6091
1146+
1.
39640552j
,-
3.
6091
1146-
1.
39640552j
])
,
a
rra
y([
[0.
3327
421
7+0.
j,0.
258
239+
0.22097
286j
, 0.
258
239-
0.
22097
286j
],

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
[0.
518
211
94+
0.j ,0.
4157
8024-
0.
328
941
1j,
0.
4157
8024+
0.3
28941
1j]
, [0.
787
86993
+0.
j ,-
0.
7767
9351
+0.
j , -
0.
7767
9351
-0.
j ]
])
)
[
11.
218
22293
+0.
j -
3.
6091
1146+
1.
39640552j-
3.
6091
1146-
1.
39640552j
]

EXPERI
MENT8
:
AI
M:Wr
it
eaNu
mpyp
rog
ramt
oswa
pro
wsa
ndc
ol
umn
sofag
ive
nar
rayi
nre
ver
se
o
rde
r.
DES
CRI
PTI
ON:
Nu
mpyEi
gen
val
uei
saf
unc
ti
oni
nth
enu
mpyl
in
eara
lge
brap
ack
ageo
fth
e
n
ump
yli
bra
rywh
ichi
sus
edt
oge
ner
atet
heEi
gen
val
ueso
rEi
gen
vec
tor
s
f
romag
ive
nre
als
ymme
tri
corc
omp
lexs
ymme
tri
car
rayo
rma
tri
xgi
vena
s
i
npu
ttot
hef
unc
ti
on.De
pen
din
gup
ont
hek
indo
fin
puta
rra
yorma
tri
x
t
hen
ump
yei
gen
val
uef
unc
ti
onr
etu
rnst
wot
ypeo
far
ray
s,o
nedi
men
sio
nal
a
rra
yre
pre
sen
tin
gth
eei
gen
val
uesi
nth
epo
si
ti
ono
fth
ein
puta
nda
not
her
t
wodi
men
sio
nala
rra
ygi
vi
ngt
hee
ige
nve
cto
rco
rre
spo
ndi
ngt
oth
eco
lumn
s
i
nth
ein
putma
tri
x.

PROGRAM:
i
mpo
rtn
ump
yasn
p
r
ow,
co
l=l
is
t(ma
p(i
nt,
i
npu
t('
Ent
err
owa
ndc
ol
')
.
spl
it
()
))
A=
np.
ar
ray
(li
st
(ma
p(i
nt,
i
npu
t('
Ent
erma
tri
xA'
)
.s
pli
t(
))
))

A.
sh
ape
=(i
nt(
row)
,
int
(co
l)
)

p
rin
t("
Giv
enAr
ray
=",
A)
p
rin
t("
Tra
nsp
ose
=",
np.
tr
ans
pos
e(A)
)

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
OUTPUT:
En
terr
owa
ndc
ol
23
En
terma
tri
xA456727
3238
4
Gi
venAr
ray
=[[
4567 2]
[
73238
4]]
Tr
ans
pos
e=[
[457
3]
[
6723
]
[28
4]]
EXPERI
MENT9:
AI
M:De
mon
str
atet
hec
ars
ale
sofas
howr
oomdu
rin
gth
ela
st6mo
nth
swi
tht
he
h
elpo
fba
rch
art
.(Us
ema
tpl
ot
li
b)de
mon
str
ate
DES
CRI
TPI
ON:
Ma
tpl
ot
li
bis a Py
tho
nli
bra
ry wh
ichi
s de
fin
eda
s amu
lti
-p
lat
for
m da
ta
v
isu
ali
zat
io
nli
bra
ryb
uil
tonNu
mpya
rra
y.I
tca
nbeu
sedi
npy
tho
nsc
ri
pts
,sh
ell
,
we
bap
pli
cat
io
n,a
ndo
the
rgr
aph
ica
lus
eri
nte
rfa
cet
ool
ki
tWi
thPy
plo
t,y
ouc
anu
se
t
heb
ar(
)fu
nct
io
nto dr
aw b
arg
rap
hsTh
eba
r()f
unc
ti
ont
ake
sar
gume
ntst
hat
de
scr
ibe
sth
ela
you
toft
heb
ars
.
PROGRAM:
f
romma
tpl
ot
li
bimp
ortp
ypl
ota
spl
t
i
mpo
rtn
ump
yasn
p
x
1=[
'a
udi
',
'
ben
z',
'
bmw'
,
'j
agu
ar'
,
'La
ndr
ove
r'
]
y
1=[
200,
250,
280,
265,
285]

x
2=[
'i
kon
',
'f
igo
',
'f
igoa
spi
re'
,
'ec
osp
ort
',
'e
nde
avo
r'
]
y
2=[
190,
160,
175,
165,
185]
x
3=[
'S
uzu
ki'
,
'Br
ezza
',
'XL6'
,
'Ba
len
o'
,'
Scr
oss
']
y
3=[
110,
120,
135,
145,
155]
p
lt.
fi
gur
e(f
igs
ize
=(1
5,6)
)
p
lt.
ti
tl
e(
'Ca
rsS
ale
sIn
for
mat
io
n'
)
p
lt.
ba
r(x
1,y
1,c
ol
or
='r
',
la
bel
='
201
9',
al
ig
n='
ce
nte
r'
)

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
p
lt.
ba
r(x
2,y
2,c
ol
or
='m'
,
lab
el=
'2020'
,
ali
gn=
'ce
nte
r'
)
p
lt.
ba
r(x
3,y
3,c
ol
or
='g
',
la
bel
='
2021
',
al
ig
n='
ce
nte
r'
)
p
lt.
xl
abe
l(
'Ca
rMo
del
s'
)
p
lt.
yl
abe
l(
'S
ale
sinCr
ore
s'
)
p
lt.
l
ege
nd(
lo
c='
upp
err
igh
t')
p
lt.
xt
ic
ks(
rot
ati
on=
90)

p
lt.
yt
ic
ks(
rot
ati
on=
90)
p
lt.
sh
ow(
)
OUTPUT:

EXPERI
MENT1
0:
AI
M:De
mon
str
atet
hep
assp
erc
ent
ageo
fst
ude
ntsj
oi
nedi
n201
9-20a
cade
micy
ear
i
nI-
IIs
eme
ste
rwi
tht
heh
elpo
fba
rch
art
,pi
ech
art
,sc
att
erp
lot
.
DES
CRPTI
ON:

Wit
hPypl
ot
,yo
ucanusethesc
att
er(
)func
ti
ontodrawasca
tte
rlo
t.
Thesc
att
er(
)fun
cti
on
p
lot
son
edotfo
reachob
ser
vat
io
n.Itnee
dstwoarr
aysoft
hesamel
engt
h,o
neforth
e
v
alu
esoft
hex-
axi
s,an
do n
eforval
uesonthey
-axi
s.

Wi
thPy
plo
t,y
ouc
anu
set
hep
ie(
)fu
nct
io
ntodr
awp
iec
har
ts

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
Wi
thPy
plo
t,y
ouc
anu
set
heb
ar(
)fu
nct
io
ntodr
awb
arg
rap
hs

PROGRAM:
i
mpo
rtp
anda
sasp
d
#Re
adt
hef
il
e
da
ta=p
d.r
ead_
exc
el(
"E:
/Ac
ade
mic
s/Py
tho
n/Adv
anc
edPy
tho
n
Pr
ogr
ammi
ng/
Mar
ks.
xl
sx"
,s
hee
t_n
ame
='S
hee
t1'
)
i
mpo
rtma
tpl
ot
li
b.
pyp
lota
spl
t
f
ig,(
ax1
,ax
2,a
x3,
ax4)=p
lt.
su
bpl
ot
s(n
rows
=4,
nc
ol
s=1
,
f
igs
ize
=(1
5,1
5))

p
lt.
ti
tl
e(
"St
ude
ntGr
ade
s")
a
x1.
pl
ot
(da
ta.
i
loc
[0:
10,
0],
dat
a.
il
oc
[0:
10,
4],
'
-.
c'
)
a
x2.
ba
r(da
ta.
i
loc
[0:
10,
0],
dat
a.
il
oc
[0:
10,
4],
co
lo
r='
or
ang
e')
a
x3.
pi
e(
dat
a.
il
oc
[0:
10,
4],l
abe
ls=
dat
a.
il
oc
[0:
10,
0],
a
uto
pct
="%1
.1
f%%"
,st
art
ang
le=
90)

a
x4.
sc
att
er(
dat
a.
il
oc
[0:
10,
0],
dat
a.
il
oc
[0:
10,
4],c
ol
or
='ma
gen
ta'
)
OUTPUT:

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
EXPERI
MENT1
1:
AI
M:Fi
ndo
utn
umb
ero
fli
nes
,wo
rds
,ch
ara
cte
rsi
nag
ive
nte
xtf
il
e.

DES
CRI
PTI
ON:
Py
tho
nha
sse
ver
alf
unc
ti
onsf
orc
rea
tin
g,r
eadi
ng,u
pda
tin
g,a
ndde
let
ing
f
il
es.
Tor
eadat
extf
il
einPy
tho
n,y
ouf
oll
owt
hes
est
eps
:
Fi
rs
t,o
penat
extf
il
efo
rre
adi
ngb
yus
ingt
heo
pen
()f
unc
ti
on.
S
eco
nd,r
eadt
extf
romt
het
extf
il
eus
ingt
hef
il
ere
ad(
),r
eadl
in
e()
,
o
rre
adl
in
es(
)me
tho
doft
hef
il
eob
jec
t.
Th
ird,c
lo
set
hef
il
eus
ingt
hef
il
ecl
os
e()me
tho
d.

PROGRAM:

f
il
ena
me=
inp
ut(
'En
teraf
il
ena
me'
)
f
=op
en(
fi
le
name
,'
r'
)
l
co
unt
=wc
oun
t=c
cou
nt=
0
f
orl
in
einf
:
l
co
unt
+=1
wc
oun
t+=
len
(l
in
e.
sp
li
t(
))
f
orli
nli
ne:
i
f(
l!
=''a
ndl
!
='\
n'
):
c
cou
nt+
=1
p
rin
t('
No.o
fLi
nes
=',
l
cou
nt)
p
rin
t('
No.o
fWo
rds
=',
wco
unt
)
p
rin
t('
No.o
fCh
ara
cte
rs=
',
cc
oun
t)
f
.c
lo
se(
)
OUTPUT:

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
EXPERI
MENT1
2:
AI
M:Ac
cumu
lat
eal
lwo
rdsi
ntot
her
esp
ect
ivea
lph
abe
tbu
cke
tsf
romt
heg
ive
nte
xt
f
il
e.
DES
CRI
PTI
ON:
Py
tho
nha
sse
ver
alf
unc
ti
onsf
orc
rea
tin
g,r
eadi
ng,u
pda
tin
g,a
ndde
let
ingf
il
es
Th
eop
en(
)fu
nct
io
nta
kest
wop
ara
met
er;f
s i
le
name
,admo
n de.

Th
erea
ref
ourdi
ffe
ren
tme
tho
ds(
mode
s)f
oro
pen
ingaf
il
e:

"
r"-Re
ad-De
fau
ltv
alu
e.Op
ensaf
il
efo
rre
adi
ng,e
rro
rift
hef
il
edo
esn
ote
xis
t

"
a"-Ap
pen
d-Op
ensaf
il
efo
rap
pen
din
g,c
rea
test
hef
il
eifi
tdo
esn
ote
xis
t

"
w"-Wr
it
e-Op
ensaf
il
efo
rwr
it
ing
,cr
eat
est
hef
il
eifi
tdo
esn
ote
xis
t

"
x"-Cr
eat
e-Cr
eat
est
hes
pec
ifi
edf
il
e,r
etu
rnsa
ner
rori
fth
efi
lee
xis
ts

PROGRAM:
f
il
ena
me=
inp
ut(
'En
teraf
il
ena
me'
)
f
=op
en(
fi
le
name
,'
r'
)
a
lph
abe
t_b
uck
ets
={}
f
orwo
rdi
nf.
r
ead(
).
sp
li
t(
):
i
f(
wor
d[0]
.
isa
lph
a()
)
:
t
emp
=wo
rd.
l
owe
r()
i
f(
temp
[0]n
oti
nal
pha
bet
_bu
cke
ts.
ke
ys(
))
:
a
lph
abe
t_b
uck
ets
[te
mp[
0]]
=[]
a
lph
abe
t_b
uck
ets
[te
mp[
0]]
.
app
end(
temp
)
e
lse
:
a
lph
abe
t_b
uck
ets
[te
mp[
0]]
.
app
end(
temp
)

p
rin
t(a
lph
abe
t_b
uck
ets
)
f
.c
lo
se(
)
OUTPUT:

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
EXPERI
MENT1
3:
AI
M:Wr
it
eaPa
nda
spr
ogr
amt
ocr
eat
ean
ddi
spl
ayaDa
taFr
amef
romas
pec
ifi
ed
di
ct
io
nar
yda
tawh
ichh
ast
hei
nde
xla
bel
s.
S
amp
lePy
tho
ndi
ct
io
nar
yda
taa
ndl
is
tla
bel
s:
DES
CRI
PTI
ON:
e
xam_
dat
a={
'n
ame
':[
'An
ast
asi
a'
,'Di
ma'
,'Ka
the
rin
e','
Jame
s'
,'Emi
ly
','
Mic
hae
l'
,
'
Mat
the
w','
Lau
ra'
,'Ke
vin
','
Jon
as'
],
'
sc
ore
':[
12.
5,9,1
6.5,n
p.
na
n,9,20,1
4.5,n
p.
na
n,8
,19]
,
'
att
emp
ts'
:[1
,3,2,3
,2,3
,1,1
,2,1
],
'
qua
li
fy'
:['
yes
','
no
','
yes
','
no
','
no
','
yes
','
yes
','
no
','
no
','
yes
']
}
l
abe
ls=[
'a
','
b'
,'c
','
d'
,'e
','
f'
,'g
','
h'
,'i
','
j'
]
PROGRAM:
i
mpo
rtp
anda
sasp
d
i
mpo
rtn
ump
yasn
p
e
xam_
dat
a ={
'n
ame
':[
'An
ast
asi
a'
,'Di
ma'
,'Ka
the
rin
e','
Jame
s'
,'Emi
ly
','
Mic
hae
l'
,
'
Mat
the
w','
Lau
ra'
,'Ke
vin
','
Jon
as'
],
'
sc
ore
':[
12.
5,9,1
6.5,n
p.
na
n,9,20,1
4.5,n
p.
na
n,8
,19]
,
'
att
emp
ts'
:[1
,3,2,3
,2,3
,1,1
,2,1
],
'
qua
li
fy'
:['
yes
','
no
','
yes
','
no
','
no
','
yes
','
yes
','
no
','
no
','
yes
']
}
l
abe
ls=[
'a
','
b'
,'c
','
d'
,'e
','
f'
,'g
','
h'
,'i
','
j'
]
df=p
d.Da
taFr
ame
(ex
am_
dat
a,i
nde
x=l
abe
ls)
p
rin
t(df
)
OUTPUT:
a
tte
mpt
sna
meq
ual
if
ysc
ore
a1An
ast
asi
aye
s12.
5
b3Di
man
o9.
0
.
.
.
.i2Ke
vinn
o8.
0
j1J
ona
sye
s19.
0

EXPERI
MENT1
4:

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
AI
M:Wr
it
eaPa
nda
spr
ogr
amt
ose
lec
tth
ero
wswh
eren
umb
ero
fat
temp
tsi
nth
e
e
xami
nat
io
nisl
esst
han2a
nds
cor
egr
eat
ert
han1
5.
S
amp
lePy
tho
ndi
ct
io
nar
yda
taa
ndl
is
tla
bel
s:
DES
CRI
PTI
ON:
e
xam_
dat
a={
'n
ame
':[
'An
ast
asi
a'
,'Di
ma'
,'Ka
the
rin
e','
Jame
s'
,'Emi
ly
','
Mic
hae
l'
,
'
Mat
the
w','
Lau
ra'
,'Ke
vin
','
Jon
as'
],
'
sc
ore
':[
12.
5,9,1
6.5,n
p.
na
n,9,20,1
4.5,n
p.
na
n,8
,19]
,
'
att
emp
ts'
:[1
,3,2,3
,2,3
,1,1
,2,1
],
'
qua
li
fy'
:['
yes
','
no
','
yes
','
no
','
no
','
yes
','
yes
','
no
','
no
','
yes
']
}
l
abe
ls=[
'a
','
b'
,'c
','
d'
,'e
','
f'
,'g
',l
abe
ls=[
'a
','
b'
,'c
','
d'
,'e
','
f'
,'g
','
h'
,'i
','
j'
]
PROGRAM:
i
mpo
rtp
anda
sasp
d
i
mpo
rtn
ump
yasn
p
e
xam_
dat
a ={
'n
ame
':[
'An
ast
asi
a'
,'Di
ma'
,'Ka
the
rin
e','
Jame
s'
,'Emi
ly
','
Mic
hae
l'
,
'
Mat
the
w','
Lau
ra'
,'Ke
vin
','
Jon
as'
],
'
sc
ore
':[
12.
5,9,1
6.5,n
p.
na
n,9,20,1
4.5,n
p.
na
n,8
,19]
,
'
att
emp
ts'
:[1
,3,2,3
,2,3
,1,1
,2,1
],
'
qua
li
fy'
:['
yes
','
no
','
yes
','
no
','
no
','
yes
','
yes
','
no
','
no
','
yes
']
}
l
abe
ls=[
'a
','
b'
,'c
','
d'
,'e
','
f'
,'g
','
h'
,'i
','
j'
]
df=p
d.Da
taFr
ame
(ex
am_
dat
a,i
nde
x=l
abe
ls)
p
rin
t("
Numb
ero
fat
temp
tsi
nth
eex
ami
nat
io
nisl
esst
han2a
nds
cor
egr
eat
ert
han
1
5:"
)
p
rin
t(df
[(
df[
'a
tte
mpt
s'
]<2)&(
df[
's
cor
e'
]>1
5)]
)
OUTPUT:
Nu
mbe
rofa
tte
mpt
sint
hee
xami
nat
io
nisl
esst
han2a
nds
cor
egr
eat
ert
han1
5:
n
ames
cor
eat
temp
tsq
ual
if
y
jJ
ona
s19.
01y
es

Wr
iteaPy
tho
npr
ogr
amt
oco
nve
rtRGBt
ogr
ays
cal
ean
dal
sodi
spl
ay
i
nfo
rma
tio
noft
hei
mag
e

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
De
scr
ipt
ion
:
Op
enCV-
Pyt
honi
sal
ib
rar
yofPy
tho
nbi
ndi
ngsde
sig
nedt
oso
lvec
omp
ute
rvi
si
on
p
rob
lems
.c
v2.
l
ine
()me
tho
disu
sedt
odr
awal
in
eona
nyi
mag
e.
Toc
onv
ertRGBi
mag
etoGr
ays
cal
einPy
tho
n,weh
avet
ous
eth
eop
enc
v-p
yth
on
p
ack
age
.Tog
ets
tar
ted,wen
eedt
oimp
ortc
v2mo
dul
e,wh
ichwi
llma
kea
vai
la
ble
t
hef
unc
ti
ona
li
ti
esr
equ
ire
dtor
eada
nor
igi
nali
mag
ean
dtoc
onv
erti
ttog
ray
sca
le.
s
tar
t_p
oin
t:I
tist
hes
tar
ti
ngc
oor
din
ate
soft
hel
in
e
e
nd_
poi
nt:I
tist
hee
ndi
ngc
oor
din
ate
soft
hel
in
e
c
olo
r:I
tist
hec
olo
roft
hel
in
etob
edr
awn
t
hic
kne
ss:I
tist
het
hic
kne
sso
fth
eli
nei
npx
Pr
ogr
am:
i
mpo
rtc
v2
f
romma
tpl
ot
li
bimp
ortp
ypl
ota
spl
t
i
mpo
rti
mgh
dr
i
mpo
rto
s.
pat
h,t
ime

i
mag
e=
c
v2.
i
mre
ad(
'C:
/Us
ers
/DELL/
Pic
tur
es/
Scr
een
sho
ts/
Scr
een
sho
t.
pn
g',
cv
2.I
MREAD_
COLO
R)
p
lt.
fi
gur
e(f
igs
ize
=(1
5,1
0))
p
lt.
su
bpl
ot
(3,
1,
1)
p
lt.
i
msh
ow(
ima
ge)
i
mag
e=c
v2.
cv
tCo
lo
r(i
mag
e,c
v2.
COLOR_
BGR2RGB)

p
lt.
su
bpl
ot
(3,
1,
2)
p
lt.
i
msh
ow(
ima
ge)
i
mag
e1=c
v2.
cv
tCo
lo
r(i
mag
e,c
v2.
COLOR_
RGB2GRAY)
p
lt.
su
bpl
ot
(3,
1,
3)
p
lt.
i
msh
ow(
ima
ge1
)
p
lt.
sh
ow(
)

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy

i
mag
e2=o
s.
pat
h.
ba
sen
ame
("C:
/Us
ers
/DELL/
Pic
tur
es/
Scr
een
sho
ts/
Scr
een
sho
t.
pn
g")
p
rin
t('
Nameo
fth
eima
gef
il
e='
,
ima
ge2)
p
rin
t('
Si
zeo
fima
ge=
',
ima
ge1
.s
ize
)
p
rin
t(i
mgh
dr.
wha
t('
C:
/Us
ers
/DELL/
Pic
tur
es/
Scr
een
sho
ts/
Scr
een
sho
t.
pn
g')
)

p
rin
t("
Las
tmo
dif
ied:%s
"%
t
ime
.c
ti
me(
os.
pat
h.
get
mti
me(
"C:
/Us
ers
/DELL/
Pic
tur
es/
Scr
een
sho
ts/
Scr
een
sho
t.
pn
g")
)
)
p
rin
t("
Cre
ate
d:%s
"%
t
ime
.c
ti
me(
os.
pat
h.
get
cti
me(
"C:
/Us
ers
/DELL/
Pic
tur
es/
Scr
een
sho
ts/
Scr
een
sho
t.
pn
g")
)
)
OUTPUT:

Na
meo
fth
eima
gef
il
e_de
skt
op1
.p
ng
S
izeo
fth
eima
ge=24003
6
p
ng
La
stmo
dif
iedda
tei
sMo
nAu
g 11
8:28
:502022
Cr
eat
edda
tei
sMo
nAu
g 11
2:58
:042022

1
.Wr
iteaPy
tho
npr
ogr
amt
ope
rfo
rmt
hef
oll
owi
ngo
per
ati
onss
ucha
s

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
Ne
gat
iono
fani
mag
e,Ro
tat
iono
fima
ge,S
hri
nki
nga
nima
gea
nd,
Re
ver
sin
gani
mag
e
De
scr
ipt
ion
:
Op
enCV-
Pyt
honi
sal
ib
rar
yofPy
tho
nbi
ndi
ngsde
sig
nedt
oso
lvec
omp
ute
rvi
si
on
p
rob
lems
.c
v2.
l
ine
()me
tho
disu
sedt
odr
awal
in
eona
nyi
mag
e.
Ma
tpl
ot
li
bisaPy
tho
nli
bra
rywh
ichi
sde
fin
eda
samu
lti
-p
lat
for
mda
ta
v
isu
ali
zat
io
nli
bra
ryb
uil
tonNu
mpya
rra
y
Pr
ogr
am:
i
mpo
rtc
v2
i
mpo
rtn
ump
yasn
p

f
romma
tpl
ot
li
bimp
ortp
ypl
ota
spl
t
i
mag
e=
c
v2.
i
mre
ad(
'C:
/Us
ers
/DELL/
Pic
tur
es/
Scr
een
sho
ts/
Scr
een
sho
t.
pn
g',
cv
2.I
MREAD_
COLO
R)
i
mag
e=c
v2.
cv
tCo
lo
r(i
mag
e,c
v2.
COLOR_
BGR2RGB)
p
lt.
fi
gur
e(f
igs
ize
=(1
0,1
5))
p
lt.
su
bpl
ot
s_a
dju
st(
le
ft=
0.1
,bo
tto
m=0.
1,r
igh
t=0.
9,t
op=
0.9,ws
pac
e=0.
4,
h
spa
ce=
0.4)
p
lt.
su
bpl
ot
(51
1)
p
lt.
ti
tl
e(
'Or
igi
nalI
mag
e')
p
lt.
i
msh
ow(
ima
ge)
L=i
mag
e.
max
()
i
mgNe
g=L-
ima
ge
p
lt.
su
bpl
ot
(51
2)
p
lt.
ti
tl
e(
'I
mag
eNe
gat
ive
')
p
lt.
i
msh
ow(
img
Neg
)
(
num_
rows
,n
um_
col
s,
_)
=i
mag
e.s
hap
e
i
mg_
rot
ati
on=c
v2.
war
pAf
fin
e(i
mag
e,c
v2.
get
Rot
ati
onMa
tri
x2D(
(nu
m_c
ol
s/
2,
n
um_
rows
/2)
,30,0.
6)
,(n
um_
col
s,n
um_
rows
))

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
p
lt.
su
bpl
ot
(51
3)
p
lt.
ti
tl
e(
'I
mag
eRo
tat
io
n'
)
p
lt.
i
msh
ow(
img
_ro
tat
io
n)
i
mg_
shr
ink
ed=c
v2.
r
esi
ze(
ima
ge,
(3
50,3
00)
,in
ter
pol
ati
on=c
v2.
I
NTER_
AREA)
p
lt.
su
bpl
ot
(51
4)
p
lt.
ti
tl
e(
'S
hri
nke
dIma
ge'
)
p
lt.
i
msh
ow(
img
_sh
rin
ked)

s
rc_
poi
nts=n
p.
fl
oat
32(
[[
0,0]
,[n
um_
col
s-
1,
0],[
0,n
um_
rows
-1]
])
ds
t_p
oin
ts=n
p.
fl
oat
32(
[[
num_
col
s-
1,
0],[
0,0]
,[n
um_
col
s-
1,
num_
rows
-1
]]
)
ma
tri
x=c
v2.
ge
tAf
fin
eTr
ans
for
m(s
rc_
poi
nts
,ds
t_p
oin
ts)
i
mg_
aff
tra
n=c
v2.
war
pAf
fin
e(i
mag
e,ma
tri
x,(
num_
col
s,
num_
rows
))
p
lt.
su
bpl
ot
(51
5)
p
lt.
ti
tl
e(
'Re
ver
seI
mag
e')
p
lt.
i
msh
ow(
img
_af
ftr
an)
OUTPUT:

1
7.Wr
it
eaPy
tho
npr
ogr
amt
ode
mon
str
ateda
tab
aseo
per
ati
onss
ucha
scr
eat
e,i
nse
rt,
s
ele
cta
nd,u
pda
te

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
De
scr
ipt
ion
:
Mi
cr
oso
ftS
QLS
erv
eri
sawi
del
yus
edRe
lat
io
nalDa
tab
aseMa
nag
eme
ntS
yst
em
(
RDBMS
)de
sig
nedt
opr
ovi
deda
tas
tor
agea
ndr
etr
iev
alf
aci
li
tyt
ous
ersa
spe
r
t
hei
rre
qui
reme
nts
.Mi
cr
oso
ftS
QLS
erv
erf
aci
li
tat
esawi
der
ang
eoff
unc
ti
ona
li
ti
es
f
romwh
ichTr
ans
act
io
nalPr
oce
ssi
nga
ndDa
taAn
aly
tic
sar
epo
pul
ara
mon
g
b
usi
nes
sest
oda
y.Mo
reo
ver
,Mi
cr
oso
ftS
QLS
erv
eri
sto
ute
dtob
eon
eoft
het
op3
l
eadi
ngDa
tab
aset
ech
nol
ogi
esa
lon
gwi
thOr
acl
eDa
tab
asea
n BM DB2.
dI
S
tep
1:Es
tab
li
sht
hes
qls
erv
erc
onn
ect
io
n.
S
tep
2:Ru
nans
qlQu
ery
S
tep3
:Ex
tra
ctQu
eryr
esu
ltst
oPy
tho
n
S
tep4:Ap
plymo
dif
ica
tio
nins
qls
erv
er.
S
tep5:Au
toma
tet
hePy
tho
nSQLS
erv
erFu
nct
io
nin
g
Pr
ogr
ams
:
#
Cre
ati
ono
fta
ble
i
mpo
rtmy
sql
.
con
nec
tor

t
ry:
c
onn
ect
io
n=my
sql
.
con
nec
tor
.
con
nec
t(h
ost
='l
oc
alh
ost
',

da
tab
ase
='S
amp
le'
,
u
ser
='r
oot
')

my
Sql
_Cr
eat
e_Ta
ble
_Qu
ery="
""
CREATETABLELa
pto
p(
I
din
t(1
1)NOTNULL,
Na
mev
arc
har
(250)NOTNULL,
Pr
ic
efl
oatNOTNULL,
Pu
rch
ase
_da
teDa
teNOTNULL,
PRI
MARYKEY(
Id)
)""
"

c
urs
or=c
onn
ect
io
n.
cu
rso
r()

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
r
esu
lt=c
urs
or.
ex
ecu
te(
myS
ql_
Cre
ate
_Ta
ble
_Qu
ery
)
p
rin
t("
Lap
topTa
blec
rea
teds
ucc
ess
ful
ly"
)

e
xce
ptmy
sql
.
con
nec
tor
.
Err
ora
ser
ror
:

p
rin
t("
Fai
le
dtoc
rea
tet
abl
einMy
SQL:{
}"
.f
orma
t(e
rro
r)
)
f
ina
ll
y:
i
fco
nne
cti
on.
i
s_c
onn
ect
ed(
):
c
urs
or.
cl
os
e()
c
onn
ect
io
n.
cl
os
e()
p
rin
t("
MyS
QLc
onn
ect
io
nisc
lo
sed"
)
o
utp
ut:
La
pto
pTa
blec
rea
teds
ucc
ess
ful
ly
My
SQLc
onn
ect
io
nisc
lo
sed

#
Ins
ert
ioni
ntot
abl
e
i
mpo
rtmy
sql
.
con
nec
tor

t
ry:
c
onn
ect
io
n=my
sql
.
con
nec
tor
.
con
nec
t(h
ost
='l
oc
alh
ost
',
da
tab
ase
='S
amp
le'
,
u
ser
='r
oot
')

l
ap_
id=
int
(i
npu
t('
Ent
erI
D')
)
l
ap_
name=i
npu
t('
Ent
ern
ame
')
l
ap_
pri
ce=
inp
ut(
'p
ric
e'
)
l
ap_
dat
e=i
npu
t('
Ent
erda
tei
ndd-
mm-
yyy
y')
c
urs
or=c
onn
ect
io
n.
cu
rso
r()
my
Sql
_i
nse
rt_
que
ry="
""
INS
ERTI
NTOLa
pto
p(I
d,Na
me,Pr
ic
e,Pu
rch
ase
_da
te)
VALUES(
%s,%s
,%s
,%s
)""
"

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy

r
eco
rd=(
lap
_id,l
ap_
name
,la
p_p
ric
e,l
ap_
dat
e)

c
urs
or.
ex
ecu
te(
myS
ql_
ins
ert
_qu
ery
,re
cor
d)
c
onn
ect
io
n.
co
mmi
t(
)
p
rin
t("
Rec
ordi
nse
rte
dsu
cce
ssf
ull
yin
toLa
pto
pta
ble
")
c
urs
or.
cl
os
e()

e
xce
ptmy
sql
.
con
nec
tor
.
Err
ora
ser
ror
:
p
rin
t("
Fai
le
dtoi
nse
rtr
eco
rdi
ntoLa
pto
pta
ble{
}"
.f
orma
t(e
rro
r)
)

f
ina
ll
y:
i
fco
nne
cti
on.
i
s_c
onn
ect
ed(
):
c
onn
ect
io
n.
cl
os
e()
p
rin
t("
MyS
QLc
onn
ect
io
nisc
lo
sed"
)
o
utp
ut:
Re
cor
din
ser
teds
ucc
ess
ful
lyi
ntoLa
pto
pta
ble
My
SQLc
onn
ect
io
nisc
lo
sed
#
Sel
ect
ionf
romTa
ble
i
mpo
rtmy
sql
.
con
nec
tor

t
ry:
c
onn
ect
io
n=my
sql
.
con
nec
tor
.
con
nec
t(h
ost
='l
oc
alh
ost
',
da
tab
ase
='S
amp
le'
,
u
ser
='r
oot
')
s
ql_
sel
ect
_Qu
ery="
sel
ect*f
romLa
pto
p"
c
urs
or=c
onn
ect
io
n.
cu
rso
r()
c
urs
or.
ex
ecu
te(
sql
_se
lec
t_Qu
ery
)
#g
eta
llr
eco
rds
r
eco
rds=c
urs
or.
fe
tch
all
()

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
p
rin
t("
Tot
aln
umb
ero
fro
wsi
nta
ble
:",c
urs
or.
r
owc
oun
t)

p
rin
t("
\nPr
int
inge
achr
ow"
)
f
orr
owi
nre
cor
ds:
p
rin
t("
Id="
,ro
w[0
],)
p
rin
t("
Name="
,ro
w[1
])
p
rin
t("
Pri
ce ="
,ro
w[2]
)
p
rin
t("
Pur
cha
seda
te ="
,ro
w[3
],"
\n"
)

e
xce
ptmy
sql
.
con
nec
tor
.
Err
ora
ser
ror
:
p
rin
t("
Fai
le
dtof
etc
hre
cor
dsf
roml
apt
opt
abl
e{}
".
fo
rma
t(e
rro
r)
)

f
ina
ll
y:
i
fco
nne
cti
on.
i
s_c
onn
ect
ed(
):
c
onn
ect
io
n.
cl
os
e()
p
rin
t("
MyS
QLc
onn
ect
io
nisc
lo
sed"
)
o
utp
ut:
To
taln
umb
ero
fro
wsi
nta
ble
:2
Pr
int
inge
achr
ow
I
d=1
Na
me=
Pri
yan
ka
Pr
ic
e=2500
Pu
rch
aseDa
te=
05/
05/
2022
I
d=2
Na
me=
Han
uma
n
Pr
ic
e=67
0
Pu
rch
aseDa
te=
04/
07/
201
5
My
SQLc
onn
ect
io
nisc
lo
sed

#
Tab
ler
owu
pda
tio
n

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy

i
mpo
rtmy
sql
.
con
nec
tor

t
ry:
c
onn
ect
io
n=my
sql
.
con
nec
tor
.
con
nec
t(h
ost
='l
oc
alh
ost
',
da
tab
ase
='S
amp
le'
,
u
ser
='r
oot
')
c
urs
or=c
onn
ect
io
n.
cu
rso
r()

p
rin
t("
Bef
oreu
pda
tin
gar
eco
rd"
)
l
ap_
id=
int
(i
npu
t('
Ent
erl
apt
opi
d')
)
s
ql_
sel
ect
_qu
ery="
""
sel
ect*f
romLa
pto
pwh
erei
d=%s
""
"
c
urs
or.
ex
ecu
te(
sql
_se
lec
t_q
uer
y,
(l
ap_
id,
)
)
r
eco
rd=c
urs
or.
fe
tch
one
()
p
rin
t(r
eco
rd)
o
utp
ut:
Be
for
eup
dat
ingar
eco
rd
En
terl
apt
opi
d2
I
d=2
Na
me=
Han
uma
n
Pr
ic
e=67
0
Pu
rch
aseDa
te=
04/
07/
201
5

#Up
dat
esi
ngl
ere
cor
dno
w
p
ric
e=f
loa
t(i
npu
t('
Ent
eru
pda
tedp
ric
e'
))
s
ql_
upda
te_
que
ry="
""
Upda
teLa
pto
pse
tPr
ic
e=%swh
erei
d=%s
""
"
c
urs
or.
ex
ecu
te(
sql
_up
dat
e_q
uer
y,
(p
ric
e,
la
p_i
d))

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
c
onn
ect
io
n.
co
mmi
t(
)
p
rin
t("
Rec
ordUp
dat
eds
ucc
ess
ful
ly"
)

p
rin
t("
Aft
eru
pda
tin
gre
cor
d")
c
urs
or.
ex
ecu
te(
sql
_se
lec
t_q
uer
y,
(l
ap_
id,
)
)
r
eco
rd=c
urs
or.
fe
tch
one
()
p
rin
t(r
eco
rd)

e
xce
ptmy
sql
.
con
nec
tor
.
Err
ora
ser
ror
:
p
rin
t("
Fai
le
dtou
pda
tet
abl
ere
cor
d:{
}"
.f
orma
t(e
rro
r)
)
f
ina
ll
y:
i
fco
nne
cti
on.
i
s_c
onn
ect
ed(
):
c
onn
ect
io
n.
cl
os
e()
p
rin
t("
MyS
QLc
onn
ect
io
nisc
lo
sed"
)
o
utp
ut:
'
Ent
eru
pda
tedp
ric
e3450
Re
cor
dUp
dat
eds
ucc
ess
ful
ly
Af
teru
pda
tin
gre
cor
d
I
d=2
Na
me=
Han
uma
n
Pr
ic
e=3
450
Pu
rch
aseDa
te=
04/
07/
201
5

1
8.Wr
it
eaPy
tho
npr
ogr
amt
odi
spl
ayt
hef
oll
owi
ng
De
scr
ipt
ion
:

Ev
ery
oneu
sesS
QL,a
nde
ver
yon
eus
esPy
tho
n.S
QLi
sth
ede
-fa
ctos
tan
dar
dfo
r

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
da
tab
ase
s.Py
tho
nont
heo
the
rha
ndi
sana
ll
-s
tar
,at
opl
ang
uag
efo
rda
taa
nal
yti
cs
,
ma
chi
nel
ear
nin
g,a
ndwe
bde
vel
opme
nt.I
mag
ineb
oth
,to
get
her
Th
efi
rs
tth
ingwen
eedt
odoi
scr
eat
eac
onn
ect
io
ntot
heS
QLs
erv
er.Wec
ando
t
hisu
sin
gpy
odb
c.
co
nne
ct.Wi
thi
nth
isf
unc
ti
onwemu
sta
lsop
assac
onn
ect
io
nst
ri
ng
Ev
eryq
uer
ywer
uno
nSQLS
erv
ern
owwi
llc
ons
is
tofac
urs
ori
ni
ti
al
iza
tio
n,a
nd
q
uer
yex
ecu
tio
n
Toe
xtr
acto
urda
taf
romS
QLi
ntoPy
tho
n,weu
sep
anda
s.Pa
nda
spr
ovi
desu
swi
th
av
eryc
onv
eni
entf
unc
ti
onc
all
edr
ead_
sql
,th
isf
unc
ti
on,a
syo
uma
yha
veg
ues
sed,
r
eadsda
taf
romS
QL.
A) Di
spl
aye
mpl
oye
ejo
ine
dint
heg
ive
nye
ar
i
mpo
rtmy
sql
.
con
nec
tor

t
ry:
c
onn
ect
io
n=my
sql
.
con
nec
tor
.
con
nec
t(h
ost
='l
oc
alh
ost
',
da
tab
ase
='S
amp
le'
,
u
ser
='
ro
ot'
)
y
ear=i
nt(
in
put
('
Ent
ery
ear
')
)
s
ql_
sel
ect
_Qu
ery="
sel
ect*f
rome
mpwh
ere
YEAR(
STR_
TO_
DATE(
hir
eda
te,
'
%d-
%m-
%Y'
)
)=%s
"
c
urs
or=c
onn
ect
io
n.
cu
rso
r()
c
urs
or.
ex
ecu
te(
sql
_se
lec
t_Qu
ery
,(
yea
r,
))
#g
eta
llr
eco
rds
r
eco
rds=c
urs
or.
fe
tch
all
()
p
rin
t("
Tot
aln
umb
ero
fro
wsi
nta
ble
:",c
urs
or.
r
owc
oun
t)

p
rin
t("
\nPr
int
inge
achr
ow"
)
f
orr
owi
nre
cor
ds:
p
rin
t(r
ow)

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
e
xce
ptmy
sql
.
con
nec
tor
.
Err
ora
ser
ror
:
p
rin
t("
Fai
le
dtoi
nse
rtr
eco
rdi
ntoe
mpt
abl
e{}
".
fo
rma
t(e
rro
r)
)

f
ina
ll
y:
i
fco
nne
cti
on.
i
s_c
onn
ect
ed(
):
c
onn
ect
io
n.
cl
os
e()
p
rin
t("
MyS
QLc
onn
ect
io
nisc
lo
sed"
)
o
utp
ut:
En
tery
ear
:1
950-
07-
05
To
taln
umb
ero
fro
wsi
nta
ble
:1
1s
har
ukh1
95020000c
ler
k
My
SQLc
onn
ect
io
nisc
lo
sed

B) Di
spl
ayt
hema
nag
erwi
thh
igh
ests
ala
ry
i
mpo
rtmy
sql
.
con
nec
tor

t
ry:
c
onn
ect
io
n=my
sql
.
con
nec
tor
.
con
nec
t(h
ost
='l
oc
alh
ost
',
da
tab
ase
='S
amp
le'
,
u
ser
='
ro
ot'
)
s
ql_
sel
ect
_Qu
ery="
sel
ect*f
rome
mpwh
eres
al=
(se
lec
tma
x(s
al)f
rome
mp
wh
erej
ob=
'MANAGER'
)
"
c
urs
or=c
onn
ect
io
n.
cu
rso
r()
c
urs
or.
ex
ecu
te(
sql
_se
lec
t_Qu
ery
)

#g
eta
llr
eco
rds
r
eco
rds=c
urs
or.
fe
tch
all
()
p
rin
t("
Tot
aln
umb
ero
fro
wsi
nta
ble
:",c
urs
or.
r
owc
oun
t)

p
rin
t("
\nPr
int
inge
achr
ow"
)

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
f
orr
owi
nre
cor
ds:
p
rin
t(r
ow)

e
xce
ptmy
sql
.
con
nec
tor
.
Err
ora
ser
ror
:
p
rin
t("
Fai
le
dtof
etc
hre
cor
dfr
ome
mpt
abl
e{}
".
fo
rma
t(e
rro
r)
)

f
ina
ll
y:
i
fco
nne
cti
on.
i
s_c
onn
ect
ed(
):
c
onn
ect
io
n.
cl
os
e()
p
rin
t("
MyS
QLc
onn
ect
io
nisc
lo
sed"
)

o
utp
ut:
To
taln
umb
ero
fro
wsi
nta
ble
:5
1s
har
ukh1
950-
07-
0520000c
ler
k
2l
al
it
ha1
968
-08
-063
023
00ma
nag
er
3l
aya2000-
02-
033
00000ma
nag
er
4s
hya
m2003
-09-
231
00000a
nal
yst
5r
adh
a198
7-05-
31200000ma
rke
tin
g
My
SQLc
onn
ect
io
nisc
lo
sed

C) Di
spl
ayt
hede
par
tme
ntwi
thh
igha
ver
ages
ala
ry
i
mpo
rtmy
sql
.
con
nec
tor

Pr
ogr
am:
t
ry:
c
onn
ect
io
n=my
sql
.
con
nec
tor
.
con
nec
t(h
ost
='l
oc
alh
ost
',
da
tab
ase
='S
amp
le'
,
u
ser
='
ro
ot'
)
s
ql_
sel
ect
_Qu
ery='
se
lec
tma
x(a
vg_
sal
ary
),
dep
tnof
rom(
sel
ectde
ptn
o,a
vg(
sal
)

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
a
sav
g_s
ala
ryf
rome
mpg
rou
pbyde
ptn
o)a
sma
xSa
lar
y'
c
urs
or=c
onn
ect
io
n.
cu
rso
r()
c
urs
or.
ex
ecu
te(
sql
_se
lec
t_Qu
ery
)
#g
eta
llr
eco
rds
r
eco
rds=c
urs
or.
fe
tch
all
()
p
rin
t("
Tot
aln
umb
ero
fro
wsi
nta
ble
:",c
urs
or.
r
owc
oun
t)

p
rin
t("
\nPr
int
inge
achr
ow"
)
f
orr
owi
nre
cor
ds:
p
rin
t(r
ow)

e
xce
ptmy
sql
.
con
nec
tor
.
Err
ora
ser
ror
:
p
rin
t("
Fai
le
dtof
etc
hre
cor
dfr
ome
mpt
abl
e{}
".
fo
rma
t(e
rro
r)
)

f
ina
ll
y:
i
fco
nne
cti
on.
i
s_c
onn
ect
ed(
):
c
onn
ect
io
n.
cl
os
e()
p
rin
t("
MyS
QLc
onn
ect
io
nisc
lo
sed"
)

o
utp
ut:
To
taln
umb
ero
fro
wsi
nta
ble
:1

Pr
int
inge
achr
ow
3
011
50ma
nag
er
My
SQLc
onn
ect
io
nisc
lo
sed

1
9.Wr
it
eaPy
tho
npr
ogr
amt
ope
rfo
rmt
hef
oll
owi
ng
De
scr
ipt
ion
:
Mi
cr
oso
ftS
QLS
erv
eri
sawi
del
yus
edRe
lat
io
nalDa
tab
aseMa
nag
eme
ntS
yst
em
(
RDBMS
)de
sig
nedt
opr
ovi
deda
tas
tor
agea
ndr
etr
iev
alf
aci
li
tyt
ous
ersa
spe
r

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
t
hei
rre
qui
reme
nts
.Mi
cr
oso
ftS
QLS
erv
erf
aci
li
tat
esawi
der
ang
eoff
unc
ti
ona
li
ti
es
f
romwh
ichTr
ans
act
io
nalPr
oce
ssi
nga
ndDa
taAn
aly
tic
sar
epo
pul
ara
mon
g
b
usi
nes
sest
oda
y.Mo
reo
ver
,Mi
cr
oso
ftS
QLS
erv
eri
sto
ute
dtob
eon
eoft
het
op3
l
eadi
ngDa
tab
aset
ech
nol
ogi
esa
lon
gwi
thOr
acl
eDa
tab
asea
ndI
BM DB2.
A)Di
spl
ayt
hee
mpl
oye
ena
mest
hatb
egi
nwi
thg
ive
nle
tte
r
i
mpo
rtmy
sql
.
con
nec
tor

t
ry:
c
onn
ect
io
n=my
sql
.
con
nec
tor
.
con
nec
t(h
ost
='l
oc
alh
ost
',
da
tab
ase
='S
amp
le'
,
u
ser
='
ro
ot'
)
l
ett
er=i
npu
t('
Ent
eral
ett
er'
)
s
ql_
sel
ect
_Qu
ery='
se
lec
ten
amef
rome
mpwh
eree
namel
ik
e%s
"%"
'
c
urs
or=c
onn
ect
io
n.
cu
rso
r()
c
urs
or.
ex
ecu
te(
sql
_se
lec
t_Qu
ery
,(
le
tte
r,
))
#g
eta
llr
eco
rds
r
eco
rds=c
urs
or.
fe
tch
all
()
p
rin
t("
Tot
aln
umb
ero
fro
wsi
nta
ble
:",c
urs
or.
r
owc
oun
t)

p
rin
t("
\nPr
int
inge
achr
ow"
)
f
orr
owi
nre
cor
ds:
p
rin
t(r
ow)

e
xce
ptmy
sql
.
con
nec
tor
.
Err
ora
ser
ror
:
p
rin
t("
Fai
le
dtof
etc
hre
cor
dfr
ome
mpt
abl
e{}
".
fo
rma
t(e
rro
r)
)

f
ina
ll
y:
i
fco
nne
cti
on.
i
s_c
onn
ect
ed(
):
c
onn
ect
io
n.
cl
os
e()

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
p
rin
t("
MyS
QLc
onn
ect
io
nisc
lo
sed"
)
o
utp
ut:
En
teral
ett
er:
R
To
taln
umb
ero
fro
wsi
nta
ble
:1
Pr
int
inge
achr
ow

r
adh
a
My
SQLc
onn
ect
io
nisc
lo
sed

B)Di
spl
ayt
hes
ort
edl
is
tofe
mpl
oye
ena
mes
i
mpo
rtmy
sql
.
con
nec
tor

t
ry:
c
onn
ect
io
n=my
sql
.
con
nec
tor
.
con
nec
t(h
ost
='l
oc
alh
ost
',
da
tab
ase
='S
amp
le'
,
u
ser
='
ro
ot'
)
s
ql_
sel
ect
_Qu
ery='
se
lec
ten
amef
rome
mpo
rde
rbye
name
'
c
urs
or=c
onn
ect
io
n.
cu
rso
r()

c
urs
or.
ex
ecu
te(
sql
_se
lec
t_Qu
ery
)
#g
eta
llr
eco
rds
r
eco
rds=c
urs
or.
fe
tch
all
()
p
rin
t("
Tot
aln
umb
ero
fro
wsi
nta
ble
:",c
urs
or.
r
owc
oun
t)

p
rin
t("
\nPr
int
inge
achr
ow"
)
f
orr
owi
nre
cor
ds:
p
rin
t(r
ow)

e
xce
ptmy
sql
.
con
nec
tor
.
Err
ora
ser
ror
:
p
rin
t("
Fai
le
dtof
etc
hre
cor
dfr
ome
mpt
abl
e{}
".
fo
rma
t(e
rro
r)
)

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy

f
ina
ll
y:
i
fco
nne
cti
on.
i
s_c
onn
ect
ed(
):
c
onn
ect
io
n.
cl
os
e()
p
rin
t("
MyS
QLc
onn
ect
io
nisc
lo
sed"
)
o
utp
ut:
To
taln
umb
ero
fro
wsi
nta
ble
:5
Pr
int
inge
achr
ow
La
li
tha
La
ya
Ra
dha
S
har
ukh
S
hya
m
My
SQLc
onn
ect
io
nisc
lo
sed
C)
Dis
pla
yth
eemp
loy
eesj
oin
edb
etwe
ent
heg
ive
nda
tes
i
mpo
rtmy
sql
.
con
nec
tor

t
ry:
c
onn
ect
io
n=my
sql
.
con
nec
tor
.
con
nec
t(h
ost
='l
oc
alh
ost
',
da
tab
ase
='S
amp
le'
,
u
ser
='
ro
ot'
)
s
tar
tda
te=
inp
ut(
'En
ters
tar
tda
te(
yea
r-mo
nth
-da
te)f
orma
t')
e
ndda
te=
inp
ut(
'En
tere
ndda
te(
yea
r-mo
nth
-da
te)f
orma
t')
s
ql_
sel
ect
_Qu
ery='
se
lec
t*f
rome
mpwh
ereh
ire
dat
ebe
twe
en%sa
nd%s
'
c
urs
or=c
onn
ect
io
n.
cu
rso
r()
c
urs
or.
ex
ecu
te(
sql
_se
lec
t_Qu
ery
,(
sta
rtda
te,
endda
te)
)
#g
eta
llr
eco
rds
r
eco
rds=c
urs
or.
fe
tch
all
()
p
rin
t("
Tot
aln
umb
ero
fro
wsi
nta
ble
:",c
urs
or.
r
owc
oun
t)

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy

p
rin
t("
\nPr
int
inge
achr
ow"
)
f
orr
owi
nre
cor
ds:
p
rin
t(r
ow)

e
xce
ptmy
sql
.
con
nec
tor
.
Err
ora
ser
ror
:
p
rin
t("
Fai
le
dtof
etc
hre
cor
dfr
ome
mpt
abl
e{}
".
fo
rma
t(e
rro
r)
)

f
ina
ll
y:
i
fco
nne
cti
on.
i
s_c
onn
ect
ed(
):
c
onn
ect
io
n.
cl
os
e()
p
rin
t("
MyS
QLc
onn
ect
io
nisc
lo
sed"
)
o
utp
ut:
En
ters
tar
tda
te(
yea
r-mo
nth
-da
te)f
orma
t:1
940-
05-
01
En
tere
ndda
te(
yea
r-mo
nth
-da
te)f
orma
t:
197
0-05-
01

To
taln
umb
ero
fro
wsi
nta
ble
:2
Pr
int
inge
achr
ow
1s
har
ukh1
950-
07-
0520000c
ler
k
2l
al
it
ha1
968
-08
-063
023
00ma
nag
er
My
SQLc
onn
ect
io
nisc
lo
sed
20.
Wri
teaPy
tho
npr
ogr
amt
ore
adda
taf
romTwi
tt
era
nddi
spl
ayt
heda
ta

De
scr
ipt
ion
:
Tweepyisanopensou
rcePythonpack
agetha
tg i
vesyo
uav er
yc o
nven
ien
twa yto
ac
ces
st h
eTwi t
terAPIwithPy th
on.Twee
pyincl
udesasetofcl
asse
sa n
dme t
hods
th
atrepre
sentTwit
ter
’smodelsandAPIendpoi
nts
,andittr
ansp
aren
tlyhan
dles
va
rio
usimple
menta
tio
nde t
ail
s,suc
ha s
:Dataenc
odingan
ddecodi
ng

S
tep
stogetdataf r
omtwitt
er:
1. Ge
ta c
cesstotheTwitt
erAPI
2.Applyforade v
elo
peracc
oun
twit
htwi
tte
r
3.Gety o
urt wi
tte
rapikeyandac
ces
sto
ken

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.
I
nfo
rma
tio
nTe
chn
olo
gy
4.Fetc
hda t
af r
omTwitt
erapii
npyth
on
5.In
stal
ltweep
y
6.Auth
enti
cat
io
nwi t
hyourcr
ede
nti
al
s.
7.Setupyoursea
rchqu
ery.
8.Col
lec
tthetweets
.
9.Crea
teada t
aset

Pr
ogr
am:

Va
sir
eddyVe
nka
tadr
iIn
sti
tut
eofTe
chn
olo
gy,
Namb
ur.

You might also like