Shaik Arifa
2 min readMay 22, 2023

LOOPING STATEMENTS : FOR LOOP

For Loop : In for loop we use membership operator “in”.

The membership operators are mainly used to check if any sequence is present in any object, we use the operator “in”, and to check if a sequence is not present in any object, we use “not in”.

In “For” Loop we use an in built function called range().

  • Here the range() determines the no.of iterations we need.
  • for y in range (1,100):
  • range() is considered as an sequential data.
  • In range the default step size is 1.

SYNTAX FOR FOR LOOP :

  • In Looping statements we use two loop control statements like “Break” and Continue”.
  • “Break” is a keyword which is used to make the loop stop or break the loop.
  • “Continue” is a keyword which is used for skipping a particular statement or iteration.
  • Both “for” and “while” loops can be controlled using loop control statements like “Break” and “ Continue”to alter the flow of the loop execution.
  • Here is an example for “Break” and “Continue” keyword.

ADVANCED CONCEPT OF FOR LOOP :
INNER LOOPS:
In Python, inner loops are used to create nested loops. An inner loop is a loop that is placed inside another loop. This allows you to perform repetitive tasks at multiple levels of iteration. The inner loop is executed for each iteration of the outer loop.

  • INNER LOOP WITH “ for ” LOOP :
  • Here is an example of Inner loop with “for” Loop:

BY : Shaik Arifa.