if you make the mistake and run this codeyou will learn quickly how to stop runaway python process on your system or find where the power-off button is on your computer this program will run forever or until your battery runs out because the logical expression at the top of the loop is always true by virtue of the fact that the expression is the constant value true while this is dysfunctional infinite loopwe can still use this pattern to build useful loops as long as we carefully add code to the body of the loop to explicitly exit the loop using break when we have reached the exit condition for examplesuppose you want to take input from the user until they type done you could writewhile trueline input(''if line ='done'break print(lineprint('done!'codethe loop condition is truewhich is always trueso the loop runs repeatedly until it hits the break statement each time throughit prompts the user with an angle bracket if the user types donethe break statement exits the loop otherwise the program echoes whatever the user types and goes back to the top of the loop here' sample runhello there hello there finished finished done donethis way of writing while loops is common because you can check the condition anywhere in the loop (not just at the topand you can express the stop condition affirmatively ("stop when this happens"rather than negatively ("keep going until that happens " finishing iterations with continue sometimes you are in an iteration of loop and want to finish the current iteration and immediately jump to the next iteration in that case you can use the continue statement to skip to the next iteration without finishing the body of the loop for the current iteration here is an example of loop that copies its input until the user types "done"but treats lines that start with the hash character as lines not to be printed (kind of like python comments