Page No.
Date
campoud iterci
wnh a program to calatak
30
of periods are qiven
ounber
pnitiple, ak ax
(12,92) hng the dis toae
coardinates (, 9), btu 2
lia avÇn
poiots
compound-iaterest(e,r, t)E
) defant p ( + rl1oo)*t
p
Yetuura Omt p
CCompoundiaterest (io0, 5. 2))
print
Cutput: I0.25
week6:
3 : r t e a puthon code to read
c phone nuaherad
email- id tromthe user aad validat it for
COxectness.
import e
inputEater phone numberi
-phane
enail : nput (" Enter emailIpi 2
f re fullaatchlr'\alLophone):
priat ('validphane")
else:
piatIavaid phant")
Paga No.
Piol CJovaid cmail )
weer1
3-ii)
import aath.
{ distaace (xi, yI, x2,y2):
**2))
Yeturo Math sgrt (x2- X1)2t (y2-y)
+priat Cdiitance la,e, alL
Outputi 5.o
Read Aame, email andphooe aunb er od odess ote
pesoa fhrongh keyboaadaad priat the detail s
address = iaputl"Address :
iaputl Email : )
phone input l"hone i ")
eriat (f"Nonei 1name \o Address i addressj\n Emai:
femait j\n Phune: phonej )
Nome: a b c e f
Addd resS: JNTU
Email: abc.23GmailCon
Ph onp:; 7/4432 SG 8 0
Page No.
Dato
Namei abcdeF
AdcresS: JNTU
Email: abc- Q3Smail com
Phone:/43 25687o
Wweek-2
print the belouw tiangle usiag for loof
5
333
2 2 2
for ? io range (5, o,-):
range
print( st()* (6 - 1)
output S
33 3
222 2
Q. write a proqram to check whether the qiveo input is digt
or lowercase character or uppercase CharactecoLaspeial
character:
ch e iaputl" tatera character: ")
-priat Diqit i1it ch- is diqlt () etse "[Link]"tch isleatr
else "Uppercase ch. isupperl) else "Spetial characte
Page No.
Date
output :
Enter a character ? HANSLLA
Veperca se
3writea pythDa program to priat the Fiboaacci
Segueace usiag uhill loop
while b 2: 100
priatlb, ead ')
Qutput i
55
3 5 8 1:13 21 34 89
H| Write a pithon pragram to print al arint aunbers in a
iaterval.
gikea
a, b 10 50
fox n in Yongela, bt):
(2 iat (n**o.5)- ):
priatln, eAd: )
|| 13 I9 19 Q3 &9 3) 37 41 H3 41
Page No.
Dato
Week 5:
0write a python proGLam that dehals amatix aod
prints
matrix (,2,31 4 5,6l, 2,91]
for ro) ia matíx
pxiatlroL)
LQutput: , 2,3]
14,5,6J
L7,8,93
(mWrite a pythan proqram to perform aaihon of tuwo
Squaresmatrices.
A: L21, 13,41]
B: Il5,6J i1, 81]
in rangellenLan]
for rolw io C: priatsáws
Loutput:l6, 8]
Lio, 123
in write a python program to perform multiplicatila ot
fwo squaYe matices.
A: 2J,3,41]
G: 15,63.[,83]
for rowinCi priatliow)
Page No.
Date
Qutput i L9, 223
L43, 501
Ho do you aalce a nm0dule Gire an example of Coastruc
-Hon of e madule using differeat geaae tical shapel
and operatioas on them as its funcoas.
Creat py fle ith tuachoas.
Loaport aad uSe it in another ffe.
Example : geomety py
det axea-circle (r) Yeturo 3-|4
def area Souare (s) Yeturo S
def area rectanqlell,w): returo
io ano ther le:
Lasage in
Laport Geontxy as q
printlq [Link](5))
pxiat lgarea square()
priatlgarea. rectangle Li, 6)
3-Use the structure of exCeption handliag al general
purpose exception.
X iatiaput " Enter nunberi ").
priat(0_/x)
except Exceptio0 as ei
priatErrorie)
Page No.
Date
output
Enter nunber k
sdo bn ERROR!
ErYoYinvalid iteral for int with base loi lc
Week -1:
ate o puthon code to merqe tuwo giuen tile coakent.s into a
third fle
with openHleitxt') as 41:
293w0 dotoiEfl. read()
with openlile [Link]) as fai
data = faread
f3 witeldoto t datae)
a Write a puython code to ope0 aqien fle and constucta
funci on to check for present îa ft and display
Lon fouad.
def check words LHile name, ards):
with op lailen ame) asS f:
for word in grcls
Pago No.
Dats
priat["'lword' fourd")
Jite e pythan code to read text from atext fle fnd the
wOKd with most numbeY of occurrences
tram coleckons împort Counter
with apenl'ile [Link]') as f:
words toread). split0
most
Couaterwords) most comnon(1)
print(" Most fequent word: most commooLl)
4. Wrte a tuncioo that reads a ile1 and displays the
nvmber ot words, aumber of YOwel s, blank 3paces,lowex
case letters and uppercase letter S
de! Hle stoats):
with opeat file [Link]') as f:
text= foread0
priatl'Words: lealtext- splitl)
print/" yowel s: SumlC: towerl) in 'aeiou' for cio ext)
printl Spaces i [Link] (' ")
print "L0wercase : Sum(C. istower) for c in text))
print uppercase: Sun(C iSupper() £xfax e in text)
file statsl)
This Iiae keeos the wiadou optn
Haput "\o Press fatec to exit)