The loop statement allows us to execute a statement multiple times.Instead of writing the same code multiple times we can use the looping statement to repeat the same code for a finite number of times. The looping statements makes the complex problems into easy one.

The general diagram of a loop statement is



Python have these types of looping statements

1. while loop - It tests the condition before executing the loop body. While loop repeats a statement or group of statements while a given condition is true.

2. for loop - The for loop execute a sequence of statement multiple times. The for loop is also called as a per-tested loop.

3. do-while loop -  The do-while loop will execute until a given condition satisfies.


Post a Comment

أحدث أقدم