Python infinite loop

An infinite loop is a loop that runs indefinitely and it only stops when there is an external intervention or when a break statement is found.

See the following loop:

CopiedCopy Code

while i<=10: 

The initial 'i' value 1 is displayed first, but it is never incremented to reach 10. Hence this loop will always display 1 and never terminates. Such a loop is called 'infinite loop'. An infinite loop is a loop that executes forever.

infinite loop example

CopiedCopy Code