Example HTML page

Loops

In general, the instructions in the program are executed sequentially. Initially the first instruction get executed then followed by the immediate instruction and so on. It is easy to execute a single instruction but what if there are hundreds of instructions!!!. For this, the programming languages are providing different control structures.

A loop statement makes possible to execute one (or more) instruction multiple times. Execution of this loop will continue as long as the condition becomes true and exits from that loop if the condition becomes false.

Python programming provides the following types of loops.

  1. while loop
  2. for loop
  3. nested loops

Python also supports Loop control statements which will change the execution from its normal sequence. Those are:

  1. break
  2. continue
  3. pass
Example HTML page

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest