Python Assignment

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

M. KUMARASAMY COLLEGE OF ENGINEERING, KARUR.

IWote a progHam to dolve a a dassic an únt


paogia)
Chincse Pgsle. e (ount 35 huads 4
44 lhgs
|among the Chickens & yabbit in a
How many syabbite & how many chickt ns do
lom.
have 2 many
Pognam
dal solu Cheads. legs):
RYO m msg o &olution'"
chicken Cownt o
Sabbit
Count =0

paint (o - msq)
yabbit_ Couwnl (legs -a * heads)/
Chicken- Count heads-y abbit- Co unt
pxint Cint (thicken Count), int (nabbit lount ))

Wyite a
Pylhon progiam o Jind and diplay
the product of thuee posi tue inlegy vaes
based On the yule mentioned below
dhoudd display the pxoduct o the
values ix ept when Dre o the ir
Value

Dn that (ase, TBhould not be


in cluded
in 1he product 6 the alues to
ib let aso
dhoutd Vot be
incuded
thee ony value to be
torsidoud , dioplay that
value itse
itacll no
Valus (an ba included in he product , display
-,

proqnam -
de ind - paodut (num ,
num a, num 3) :
M. KUMARASAMY COLLEGE OF ENGINEERING, KARUR.

pxoducto
Tl Cnum !=1 and num a! 7 and num 3!=1):
pt odut numi * num 2 num 3
alil num ) ==1):
podu ct - hum Q * num 3

produ et
num 3 -
il Cnum 3 = =1) :
Product e-l
etwtn Produt
pxoduct ind- product (3,6,1)
print (produt)
A eachey is in the
paoess o gunejating
posu baucd On the matks
the
dtudtnto class în
Project based OBsessent .
Assume that the maks ol hey 10 &tuden
the
class, a
Out yeturn many have
toxed
o in The
orte
d
the manyd
loxa
mrks populaled 1he list.
e
Tmplement G haue tHoco d in in
a
maks kind QUAVage
mk
o how haue maotks
who Find dame
': , many be
) populat
The to dtudent
auetage :: the many have
diortd
dtortd the to
g9am ) dhould
tuple rquny d
doe
How dont D
rom
pro untieu- an
how
&
hould
bs
be
a o psult&
yeturned
)'-
in
avilable
e Python th -
the
peventage haue incrtas
ing
ordir
oe xample
3 Sont_manks
jollaudingm thanbyenyate many
ind- dtudent
25.
o wyite
a The
vales
|: the mo how haue lst
3
M. KUMARASAMY COLLEGE OF ENGINEERING, KARUR.

(Pxognam
list. ol_maks (12, 18 25,àh, i5, 18, ao, a0,31)
de ind- moxe- 1han - auerage (J ?
globad lat- o-maks
marks 0
Count 0
on xin list
ol-mar ks:
QueMage = matks | len(list-o- manks)
{ox x in list - ol -
maks:
il x> auerage i
Count t
parentage - (lount *L00) / en(list ol -manks)
aturn parantage
dul bont- maks D:
globat lit. of marks

list o- maks Bortad (lit- ol-


marts)
qelurn lst- o - marks

qlobal lit- o- mavks


or x in range lab) :
Count =0
{on yin lst - ol-marks :

Count t 1
tug append (lount )

print ( ind - moe -than - ue rage 0)


4 Write a
Pytkon unchon, nde- paíu-d
numbeys D) which acepts a lit o! positive
integos with SHepetttiors & eturns lo unt
ho

o paiss o numbs in the list that


adds up to n. The uncion ko utd xutuonn
ENGINEERING, KARUR
M. KUMARASAMY COLLEGE OF

0, I| no duch pas ae oun d In the liat


Abo wite the pytut tat Cases to tost the
Program
Prognam
de ind - pabs -o numbs (num - list, n):
Count =0
on x in num list
induz num- list. inde l)+)
{or y in yange (indix, len
lnum _lút)) :
i) x+num - lis t ly] n:
Count t =)
oturn lount
hum Jit , 2,1,4,5,6, o,3]
print | ind - paia - ol- numbstu
(num -lät, n)
Pylhen progaum
progam to düplay all the
lommon chayactus bloen two dtings
eturn- theye b ho mat chleh chayactes
progam
dud lirnd (ommon - chaa duy S(mg! maq2):
or x in msq 1
x
(ontine
{or yin msq a:
X

Continue
ix in lút:
brtak

list. append (r)


M. KUMARASAMY COLLEGE OF ENGINEERING, KARUR.

beak

Output -"" join (list)


{ kn (outpt) = o
eturn -I
else

aturn output
|=mp to "

mo to !

Common - chayatos ind - Com mon -chayaders

print (Common - Chayactes)

You might also like