Page 135 - CodePilot V5.0 C7
P. 135
BRIDGE BACK
1. What is the full form of IDLE?
2. What is the use of the % operator?
3. Fill in the correct operator.
(a) 6 3 = 18?
(b) 8 4 + 4 = 6?
In the previous class, you learnt that Python is a high-level, interpreted programming language
known for its simplicity and readability. You also explored how to download and install it on your
system and wrote and executed simple short programs in Python. In this chapter, you are going
to move onwards with Python basics and write more advanced programs.
PYTHON STATEMENTS-FLOW OF CONTROL
The order in which program statements are executed is called the flow of control. It can be
sequential, selective or iterative.
In all the programs you have written so far, the statements execute sequentially—meaning one
after the other, from top to bottom in the program. This type of flow is called sequential flow.
In selective flow of control, also called Decision Making, the interpreter chooses which statement
to execute above others, whereas in iterative flow, some statements are executed multiple
times. You have already learnt about sequential statements, let’s learn about the other flow of
control statements.
PYTHON SELECTION STATEMENTS
You make many decisions every day—like “What should I eat today?” or “Which shirt should I
wear?” Each of these decisions is based on a certain criterion. For example, your food choice might
depend on your mood or whether you’re following a specific diet. Once you’ve made the decision,
you follow it with an action. Therefore, decision-making is a two-step process: first, deciding what
to do based on a criterion and second, taking an action.
IF STATEMENT
Decision-making by a computer is based on the same two-step process. In Python, decisions are
made using the if statement, also known as the selection statement. When an if statement is
executed, the computer evaluates a condition (a logical expression). If the condition is True, the
action inside the if block is performed. If not, it will be skipped.
133
Flow of Control in Python

