Skip to content

Instantly share code, notes, and snippets.

@kkt-ee
Created January 1, 2020 15:14
Show Gist options
  • Save kkt-ee/913b90068132ca56737b5b1b22aee8df to your computer and use it in GitHub Desktop.
Save kkt-ee/913b90068132ca56737b5b1b22aee8df to your computer and use it in GitHub Desktop.
demo flow control: exit program with sys.exit()
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