Introduction to Loop


☞ Loops are used to execute a block of code repeatedly.

☞ It is also known as repetition or iteration.

☞ Why use a loop?

Suppose we want to print a name 10 times, then we can do it by writing name in print() function 10 times but this approach is not a good approach. To complete this task loop statement allow us to execute a statement or group of statements multiple times.

☞ There are two types of loops :

1. while Loop
2. for Loop