Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 80 - 2615_KEC
P. 80

    B1
                      FLOW OF CONTROL                                                                        CHAPTER

                         Learning Outcomes

                         The student will be able to:
                            learn about sequential and selection control structures.
                            understand the concept and syntax of a for loop.
                            understand the concept and syntax of a while loop.
                             apply jump statements (such as break, continue, and return) to alter the normal flow of program execution.

                      As you know, a computer program is a set of instructions given to the computer to perform
                      a specific task. These individual instructions are known as statements. All the statements are
                      executed  sequentially,  one  after  the  other,  as  they  appear  in  a  program.  However, in  some

                      situations,  we have to change the order of execution of the program based on certain conditions.
                      In such situations, we use control statements to control or change the flow of execution.

                                CONTROL STRUCTURE

                      A control structure is a programming construct that affects the flow of the execution of a program.
                      Various types of control structures provided by Python are shown below:

                                                               Control Structure

                         Sequential Statements                Selection Statements                 Iterative Statements

                                SEQUENTIAL STATEMENTS                                                       Statement 1

                      The statements  that  are executed  in sequential  order, i.e., one after the         Statement 2

                      other without any jumps, are called sequential statements. A sequential
                      structure is also known as a straight line path.                                      Statement 3

                       78   Premium Edition-VIII

| 75 76 77 78 79 80 81 82 83 84 85 |