You are on page 1of 17

L E 6

DU
MO
 1. The
ED
ME
s
unde tudent ar
RNIN INTEND rstan e able
d
TCO cond
itiona the conce to
l state pt of
ment
s
 2. The
G OU

s
cond tudent ca
itiona n app
progr l i n s ly
amm ol
ing p ving
roble
ms
LEA
Are y
o u re
a dy f
PHA or
SE II
I?
 LETS
STAR
T ;)
IEW
 What are the 7 operators in
RE V python?

 Arithmetic operators
 Assignment operators
 Comparison operators
 Logical operators
 Identity operators
 Membership operators
 Bitwise operators
 THE S
STR ELECTI
U ON
MAK CTURE
L
NTS
ING -
ONA STAT DECISIO

ON)
EME N
NT
EME  Decisio
ECTI depen n making
DITI

d
need ing on th statement
to be e con
dition is
STAT

is dec execu
(SEL
CON

ided ted o block


 If the c by conditio not which r
block ondition i n.
will b s "tru
cond e
ition e execute " stateme
block is "fa d, if nt
will n l se" th
ot be en sta
execu teme
ted. nt
 In this
discu section w
L
ss ab e are

NTS
ONA then- o

ON)
ut if-
else ( then
neste if els (if), i
d if s e), an f-
EME
ECTI pytho tatem d
DITI

n lan ent. I
three guag n
types e ther
STAT

maki of e are
(SEL
CON

ng sta d ecisio
 if teme
n t.
n
 if-else
 If-elif-
else (
neste
d if)
 IF STA
TEM
 If - i s ENT

E NT
of De most basi
cision c stat
statem maki emen
en ng t
ATEM
to ex t . I t te
ecute l ls to
code a cert progr
only ai n p am
cond if par art of
ition ticula
 One-w is true. r
IF ST

ay se
lectio
n
E NT
ATEM  Syntax
If (co
nditio
n) :
>>sta
teme
nt
IF ST
IF ST
ATEM
E NT
 Examp
le
 a=10;
E NT
 if (a<1
ATEM 0):
print
(“a is
less t
han
10“)

 Outpu
IF ST

t
 a is les
s than
10
 Examp
le
 a=9;

E NT
 if (a<1
0):
print
(“a is
 if (a>1
ATEM
less t
han
0): 10“)
print
(“a is
great
er tha
IF ST

n
 Outpu 10“)
t
 a is les
s than
10
 IF-EL
SE
SE S
 In gene TATEME
NT
IF EL
execu ral it can NT
EME statem
te on
e blo
be us
ed to
e n t ck of
block amon
s, i n p g two
STAT

if and ython
e
in py lse are th language
thon e key
 Two-w word
ay se
lectio
n
 Syntax
 if (con
SE
dition

NT
State
):
ment
IF EL
s
EME true
#if co
nditio
n bec
 else: omes
STAT

St a t e
ment
s
#if th
false e co n
dition
becom
es
IF EL
STAT SE
EME
NT
 Exam
ple
 time=1
0
 if (time
SE
NT
IF EL <12):
print
EME ("Go
 else: od m
orni ng“)
print
("Go
od
STAT

after
no on
“)
 Outpu
t
 Good m
ornin
g
E
E
C T IC 2. Wr
R C IS
ite a
the u progr
ser to am th
obtai enter at ask
ns th n s
PRA

e num um bers 1
EXE
user, -12,
then bers f
mont print ro m t
h (IF the eq he
STAT uival
EME ent
NT)
E
E
C T IC 3. Pro
R C IS
gram
age o
f the that will a
if the user a ccept
u s er i nd de the
PRA
EXE
or no s a qu termi
t. ( I F alifie ne
STAT – EL d vot
EME S E er
NT)

You might also like