Created
January 1, 2020 15:14
-
-
Save kkt-ee/913b90068132ca56737b5b1b22aee8df to your computer and use it in GitHub Desktop.
demo flow control: exit program with sys.exit()
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
import sys | |
while True: | |
print('Type exit to exit.') | |
response = input() | |
if response == 'exit': | |
sys.exit() | |
print('You typed '+response+'.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment