In Python, a flag serves as a signal to the programme, indicating whether the programme as a whole or a specific piece should run. To put it another way, you can set the flag to True and the programme will run indefinitely until anything causes it to become False.