Tutorial
Infinite Loops in Python
In Python, a while loop will continue executing as long as its condition remains True. If the condition never becomes False, the loop will run forever — this is called an infinite loop.
Example of an Infinite Loop
A infinite loop will make your system hang.
How to Stop an Infinite Loop
- Press Ctrl + C in your terminal to interrupt execution.
- Ensure that your loop has a condition that will eventually become False.