You are on page 1of 17

Date

Expt. No. Page No0.

and oheck
functien for inpul a
haue many uouels present in hat st£ng and csunt

Sntvsduction : JheAugh this pragam


enctisnfoxandcxealing
counting heus many uauels pesent in
Lit.

sauxceCode
de< count ()
= input (Enten &buing of line i ")
y = ' a ' , ' e ,'o',u, ',E',L CO

s i in yi

pxant()

Qutput i
Enton stuing of line i "Rahl"

ConclusRn i This pxagram ii done by using statom


ent used fer losp. hat i statiment checks the weuea
icsnlaina heus man ueuala in it eth sespe
- c t t the tist ndthen itçatts the no. usela
and diplays thu autpuk
Teacher's Signature
1Date

Expt. No. Page No.

uaite fpragnam to oxoate tuuo functions abcC) and


yz lse abe()for additin c 4 numbes nd ae y2l))
to check add no. and lisplay the both fun
ctions:

Snbuaductisn: Jhuaugh this pxagram tue cueitll he going to


leaun hat tuouncticns fivst uit buing the autpt
Amand the nezt funotisn tusill chck
BouHce Codei
de abe (abicd)
S= a+b+otd
pxint Cs)

pxunt("Euen")
else
pint ( Oda")
a int nput ("Entex")
b: int (nput (u Enton ")
C= int (input ("ntex ")
d: int (input ("Entox ")
int (inp ut ("entox ")
y- abe (asb.c.d)
abe (a. b,c.d)

Gutput r
Entoui
Teacher's Signature
Date

Expt. No. Page No.

Entoy 9
nto;10
Entbu12
34

Cenolusipn i JhxAugh thu pagxam


foHgKam ue'ue
ue'ue seen that is
lone by tuo
am the CAeY
functieny one eehich takes fsun ualueA
nd giues the sum o t andsecend
Aunoticn checks tuhethon tthe dlem
d ualuea is odd
by cliding the bum lth moduluA a R
ond i it setwens
odd
the functisn gues the

Teacher's Si¡
Date

Expt. No. Page No.

elsito
program to input Y6 sctigiL no. and find sut
each digit ecuHenceand a dictisnay
Sntneductian ii hi proqram uill take 15 iqit
Cnput and then he ed in a dichonaey
and
coLuntod csing lacpa
KiowceCodei
a- int (input("nien 15 digit no ")

|de< abc (a):


n ai
fox in ai
C=Ctl.
if i nst in a

pint()
abe a)

Teacher's Signature
Date

Expt. No. Page No.

pHoqam to input 19 digit find out each


aigit Occuance andstore
dictionay
sntxocuction i- his pgxam enil take 9 digit no. QA inpat
Land then the ceill bestaed in a dickonauy and be
digila
COuntod
using muiple Loaps
douxce Code'i
az int input ( Satoy no. ")

def abe

if i=j
if i nat in a

pxint(z)
abc()

QutputS29SSTGSA3Is49G321.
355,2:2.9:2I6342,3:2.112

Sonolesion i Thxough this


pogam e haue teaxnt haccoto
get the OCUnence each digit csLng lanps be, cue haue
eused tuuo laspoij and takon Bom ame uaxable
cmy and i the condalicn i s e thtt i and are eguel
Qdaed
uaue and displat
Teacher's Signature
Date

Expt. No. Page No.

nite a progxam to cuate tuo funcions fon


daft cliagonal matisand stum of suight diagonal matuit
Sntoduction his HoQHam ceil take a square mabix
as a nput and then find the sem af deft and wight
iagonal mabix and Qet the esull

La-lLL2,3l.[4,5,6].s.sl
def sond(a)
foiin oange (3):
fon in oange(s)
pnint(e)
def sold (a):
fo i in nanqe (3):
fon 4 in nange ():
dedsatllil
pint (a)
sord(a)

|tput

Teacher's Signature
Date

Expt. No. Page No.

Conclusian i Shsaugh this puog am cue haue leaenl that


uaing a squave matuiz Le hauehaueto fend eeet smo
eht diogonal ofa matizso ue took tuo Hanges
upto D. i iequals to then ue gct the déagonal waluesf
eqht diagonal matxix and then scen p the wales oft
And again in anathen functisn ue haue tofind eut the áum
cue haue taken tuuo
eft dliagonal maliz io ualues 2hen
áo again
u qet te diag
pto 3 if itj egualsto
e

the
anal walues f left dingoál matuiz ond then sum up

ature
Date

Expt. No. Page No.

Witoa forogam to ate a funcuion of tist and


clisplay he add positian ualues into anotheA list

Snteoducton'- This pogam uill. list ond


Hetexns the Qdd posteon ualucA nto vanothen meus

soxce Csdei
lazLi,2,3.S,9,H, 6,S, 4

olet odd (a):


fan i in a'
if a. ndex ()/, 2 ==l
Kappend (i)
pHint (z)
odd (a)

Qutput
i3,9,G,

Conolusion ThOugh this progam ue haue eaunt to


check f the ndox ualue e alist s odd and disph4
the ualue uem a neu lest. Bo. cee hauo
taken teun lists @ne cehoxe leady ualues beng tuxod
Land Qnothon nell Jist. n the furnctien eLee haue cealod
a losp ak getlirg the ualues frcm list and thon
check cuhelhon the index that uelue
yes than ppends ct into

Teacher's Signature
Date

Expt. No. Page No.

Celute a prgam to create funclion to take. angu


ment QS a ttpe and emaues Qdd pasetion ualues
sm the tupe.
iple que he output in tuple
Sntundecticn' Jhi, pHogHam uill take tuple o ualues
containng in it and etusns the tupe atenemour
oddpcaLticn ualuss fram
Wauxce Codei
a-2,B9,S4GGSu)
det odd (a)'

if q ndex )22=20
append )
z =tuple ( )
pxint(z)
Lodd(a)

Qutput'
(2,9,4, Ssu)

Conctasion Ihuough this pxogiam tue haue leaxnt to


axgumeat as tupb and chock poditional ualucis
odd and omausA it. lle hau taken a tupk containing
Imeltipte ualues an it andénphy ist Jhuagh tunctian.
ue haue use a lcap sconuexlng the tple into leiz
andcheckifhe pasulional uales he list is odtd!
Teacher's Signature
Date
Expt. No.
Page No.

then YeMCes t by cusng conditional salement that


the poslionad ualue then appenlA he ualue
mecun. T adda enly euen pooetion and
fhe odd po&Ltuinond ther OonuYtod the
tist agan into typle

Teacher's Signature
Date

Expt. No. Page No.

Lto fundactaal nd bum oflistof numkon) uaing


unctiens.

Snivodclian Jhç puogxam uulU ceate a functuon tuhich


a
will wLAer end and 7ind the
Aackoial uaue a it and anctho function uuhch
getec numbonand isplays the
numbeXA fam it

doCelodei
def abc 0:
a= ínt (input" nter a number;")
b=l
fore i in Range (1a+l):
b= b*i
pnint (o)
def yz( (nput ("Enten a list of numben )
d- int

fon i in ai
print (c)
pxint( fon factonial. 2fon Sum of list of number")
on 2;)
nput Enter choice 1
4- int

abe)
if y==2:
Teacher's Signature
Date
Expt. No.
Page No.

Qutputi
4 fonfactooial. 2foe sum of digit of ist of nurake
ento choc cn 2

120

fore factoal, 2fon seLm ot diqit af üt oy nLmbx


Entox a dist oh nambori 2,9.Lo9.15

housto
cue haue loaunt
Conclssni AAom ths progAam ceethch ue haue
menu dyiuon theaugh
t o hooe and t mil dsplayAceE
to
Date
Expt. No.
Page No.

Cealea suncton o menu duen pogam to mpe


he
mathematical Aunctions -i
L) ofid the
Cu) Joind squt foct) c<a numbn
SntvoductLsn' Ihis puooHam uiucucatee functon o men
diuen ushioh cuiu oel
get -he AQLONA numken o t ogualue
and
the et ualue it and displays it AccoHdingy
dounce Ccocde i
mpost math
def abel)
a- int (input (entou the numbox ")

puintch)
def mn
m: cnt (unput (u Entor the num box"))
n- int (nput (u EniH baxe "))

phint
def ye ))
x int (input (Etex numben
4 math squt (x)

dE nt nput ( Entex cho ica ")

Teacher's Signature
Expt.No.
Date

Paye No.
if d=-2:
mno()
ele

Qutput'
Sntoy choice
Ento the numbox
25

onclusion hi
pgam ill hetp userto
Lnathematical fuctien numkn
pefomn thyoe.
Expt. No. Date

Page No.

Ceeate
betucen 4to6 enpogam to gnaate andom numko

Satodctisn i-
to geneale
Thuoughttis ce ceeell gel to know
caudomnumb0 belcon4to and
displays any nunko
Mndomly
Mouxce Codo :
Ldef abcO:
Lmpatt andom
Hint antom Mandi t (L6)
abcc).

Qutput'

Conclusion Ihuough thisunckion ue cn genOHQle Handom


numbo% betueen to6 by using Mandint ()

Teacher's Signature
Date

Expt. No. Page No.

Cueate a python pxogam


puogQm to Head a Jent file lene
and uostd Acpexalod byy hashiag
display eaah

Kntuoducttm Shxcugh this pogamn ue ceil get to kno


hc to e d a text gile
the
display
HOadlnes (
teands by hashtaqexe.
OHats a list cehichis bingtuauensod and concatel
i th #

owce Coto'
Qzopen["aba: tt ",'n)

fon ?inb:
C=i spùt)
for in e
pent (¤ #)

Output
bo tezt T am Rohul
playing cxiokot
T# an# Rahul H
I# lou #playing #t oickeltt
ile harding puogxam Ehas a tet
ile cuhich itox alod by fox Labp

Teach
ExptNo. .
LdotalA
be a= Sntoductin
ttuccnt
details deaxn
af us
ouHce
code cseHLate
intinput open
pickle
le)
dump 4 NE haw
nput (abe.dat
Hange
(in
h) ( mest to a
input
nput to Cetenpython
:contain
{"Enten ("("Endor Jhxogh
cxeai
"Enton Enter ","cub)
dumpl.
cesengby puoguam
no
a thisa
RoluAame. no
name)
maka
toll
stucdont binay
peeqkam
stcdent
to
") no.
ueate
)
detaila file Manka)
ue cetreels
uhih uill a
)) binay PageNo. Date

otoes be Jtudent
file
gong
nino uuhuch
to

You might also like