0% found this document useful (0 votes)
9 views

5 Mark For Python

Uploaded by

karthi7200139446
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)
9 views

5 Mark For Python

Uploaded by

karthi7200139446
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/ 7

1. Sele ction control!

2 if.... else

Boolean ecpoussion :

I3 3
|20 60

1
Toue an d Truue

Statem ent

Boolean
expesion Tsue
False
Bleci ot
Blok af Statements
Stutenents

Block of Statements
0f 8tatement!
The i gtatem enk evaluates the þoo lean

expreson pnst t the gesult Is tue the blok


Statement ececuted. Otherwise , the nect
Btatenent aten the if condltfon tfe stutenent
block w l be eeecuted.

Statement

False Boolen
espnton

Tre

| Blocs of btatements

Block of statements

t To check the humben s tVe on Ve


a= Rnt(input lEnten the
intagen Vale:))
Print ( The vale to d is pesitive a)

negatve %a)
Q.
Stotenent 1f
bloc -
else :
Blockof else
i4
8taternents oß
statements
Block oß False statement culU
statement
The
btatements
BlockBoololean
i
- be
|Statement | else :
expresion: Stuten
ents ete
exprentoBoolean wilciuted. the
statenent
be elt
otheuse,
executed.
Blouk o Tue is
8tatements evaluates
tue

the the
else block
the

boolean
pwt o
loop!
Condltfon neveniInpinite
wheeh dalnite
Roop false. xample:
Tnlonop
An Output Prént (ie=n)
while :
Ffbonacel
benies # A
n
n= Kknoun the Ininite
So,tenirates Ent a (" fnt(
Depnite in
int numbe the Prant(i)
befo e the ne input
input Swn
bloc the
Noop
a loop teActiye ("Enton
the tmes Itertlon. yalue
( b o s
Please an
escution an statement s"
he
toratRve Btatement a
tonatLive 2Sum) pOs2tive
enten loop That
of to
Stsute etecuted hevenmears,
the 8tuctwe ntegen"J)
the be
nunmbe
esteuted
loop. becomus the
:")) n over
that
fon ? fn ange (i, n-):
nvaue = fvalue+ Bvaue
lvalue= Svale
Svalue= nyalua
Pint (", n nyalue Sep= ende"
")
?
ne
element location. locatfon. aeneral
fuom eisting the heu ist
the t en
ed value ex
al
the the alue opanat?ons
ListThe Ast
lest
o a
S. value 4from
spectgled
veo the
3spetied at ctth
2 opratfon
Delete teAppend cipdate Retxleve 2 I.
element a
Inóert
the elements reate
lst. th SpetlEad
or. loeatfon
locatfon :
lsed
ocatfon. emove
oneist. Ubed -
neco speteol
used - - -
vale used at dt
The Thls
smove to
to to ae s
tocatfon. InftPal
gten Afton tooperatfn
at Locatfon oprtfon wsccl
add moved
the thypdate
e
removingelementan necw tme to
peceec speelflad used toThe CLeate
elament the Tnseet
Sue
elements
to
the cesive empty
at
get a
calling value and utwunng fenction:
Zeto 6 mose etcxn
A furction may Contain
etun Can be sed only when
Natement. The
valu kack to the caller and
eguired to pass
o reton Statment is not Kondatony
Cases, the' caleulated faetosial valus
Th Bome
puwther calatlon fn th cald
yequied for
Progran place
caling vola onod retas'ng ucton
# Factonal wstng
# functfon dinitlon
def fact (ni):

for ? in gange (1, ni+1):

retun (F)

# man module
n = înt (input (" Enten'n'
value:)))
A = fnt (Pnput Enker a'value : )
fact (n?/fact(»)
fact Cn) fact (s) *faet (n-)
Pnt ( Answer Ron npr s:", npr)
Print (" Anbwen fon nc s :",nca)

You might also like