Python runs in your browser. Heavy or infinite loops may freeze your browser tab. Use "Stop" if needed; for heavy jobs, run locally.
Program 1
While Loop
Understanding While Loops in Python
Initialize a Variable:
The variable i is set to 1.
While Loop:
The loop runs as long as condition is True i.e. in current case i is less than or equal to 5.
Print Statement:
It prints the current iteration number (e.g., "This is iteration number 1").
Increment:
The value of i increases by 1 in each iteration to prevent an infinite loop.
Output 1
Program 2
While Loop
Output 2
Program 3
While Loop
Output 3
Program 4
While Loop
Output 4