Professional Documents
Culture Documents
3-CMPS151-F22-Decision Structures and Boolean Logic
3-CMPS151-F22-Decision Structures and Boolean Logic
Chapter 3
Tamer Elsayed
CSE Dept.
Set of statements that execute in the order they appear.
stmt1
stmt2
...
stmtn
Continue afterwards
yes
Wear a coat no
Wear a hat
Wear gloves
yes
Print “Passed”
Print
“Congratulations”
Block2 Block1
if condition:
Block1 # block of statements
else:
Block2 # block of statements
no yes
condition2 Block1
no Block3
condition4
yes
Block5 Block4
Operator Explanation
and relational expression is true if both 0,0=0
0,1=0
Example:
8<9 or 5==6 8 < 2 + 7 or 5 == 6 true
true or false
true
evaluated evaluated evaluated evaluated
2nd 1st 4th 3rd