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

Decision Control in Python

The document discusses different control flow statements in Python like if, if-else, and nested if-else statements. It provides examples of using if, if-else, and elif to check if a number is positive or negative, and examples of nested if-else statements. The document also discusses the differences between single line if-else expressions and if-else blocks.

Uploaded by

Firoz Ansari
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)
45 views

Decision Control in Python

The document discusses different control flow statements in Python like if, if-else, and nested if-else statements. It provides examples of using if, if-else, and elif to check if a number is positive or negative, and examples of nested if-else statements. The document also discusses the differences between single line if-else expressions and if-else blocks.

Uploaded by

Firoz Ansari
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/ 12

Full stack web development using python

Decision Control

Saurabh Shukla (MySirG)


- Agendas
① Control statements .

② if
③ if else

④ if elif else
⑤ Single line if else
Controlstatemnt

Ñ→-
① decision control
→ if else
② match case
elif else
control
③ Iterative ↳
smgfehneifelse
egwerd

f;
Block
*
Clcttsava Python
if {


É ⑤
-

< indent
Write to check whether
a
program
number is
positive or non positive
a
given
))
"
( input (
"
a = int Enter a number

if a>0 :
)
" "

print ( Positive

if a < =o :

print (
"
Non Position
"
)
Keyword ifelse_
p

"F
if candi

E-
→ eh
keyword
]
a else
block
Write to check whether
a
program
number is
positive or non positive
a
given
a = int ( input (
"
Enter a number
"
))

if a> 0 :

)
"

print (
"
Positive

else :
"
Non Positive
"
)
print &
if elif else

if condition :

elif condition :

elif condition :

elif condition :
=

else
:=
Write to
print grade obtained
a
program
in a test .
Take marks obtained from
user and display the
grade .

A
90 < marks ≤ 100
90
B
80C marks ≤
C
80
70 < marks ≤
70 D
Go < marks ≤
≤ 60
E
50 < marks
F
be 10%50
Singhelineifelse
if condition else code 2
cadet

U
f- F

dine if else expression


Single is an

but if else is not an expression


code 2
: ✗ = code, if condition else
if _

else
Write a python to check
program
whether number is positive
given
a

or non positive .

) )
"
"
"
number ) else Non Positive

( intinpntc >0
"

print
"
positive if Enter a
Nested if else

if condition :

else
:-,
=
else
:-,

You might also like