Chapter-4 - Flow of Control
Chapter-4 - Flow of Control
Types of statements
» Compound Statements
• if else
• for
• while
Statement Flow Control
if <condition1>: like -
statement(s) when condition1 is true
elif <condition2>:
statement(s) when condition2 is true
elif <condition3>:
statement(s) when condition3 is
true
else
Nested If -else
Loop/ Repetition/ Iteration
• in operator-
3 in [1,2,3,4] will return True.
5 in [1,2,3,4] will return False.
– not in operator-
5 not in [1,2,3,4] will return True.
Table of a number by For loop
Syntax of For Loop
While <LogicalExpression>:
<loop body with increment
or decrement>
Output
Start
Stop
Step
Jump Statements
break Statement
statement5 statement5
Jump Statements
break Statement
Output Output
Jump Statements
continue Statement
statement5 statement5
Jump Statements
continue Statement
OUTPUT
Assignments