9/2/26Less than 1 minuteAbout 61 words
Concept: break
The break statement can be used to exit a loop before the loop condition is False in a while loop, or before the loop has iterated over all items in a for loop.
while True:
command = input("Enter a command (or 'exit' to quit): ")
if command == "exit":
break