Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
py-quickstart/docs/Iteration/while-loops/example-3.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
17 lines (17 sloc)
566 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# example-3.py | |
# Simplified executable run loop | |
check = True | |
count = 1 | |
while check: | |
if count == 1: | |
print("This program will continue to run until you tell it to stop!") | |
print("Do you want to stop yet?") | |
if count != 1: | |
print("How about now? ") | |
answer = input().lower() | |
stop_commands = ["stop", "exit", "yes", "sure", "get me out of here you filthy mudblood!"] | |
count += 1 | |
if answer in stop_commands: | |
answer = input("Are you sure? ").lower() | |
if answer in stop_commands: | |
break |