Skip to content

Instantly share code, notes, and snippets.

@christoga
Created April 17, 2017 16:14
Show Gist options
  • Select an option

  • Save christoga/e6175ac6df16ee2ae51fe25da7f83dd2 to your computer and use it in GitHub Desktop.

Select an option

Save christoga/e6175ac6df16ee2ae51fe25da7f83dd2 to your computer and use it in GitHub Desktop.
Python exit snippet
#!/usr/bin/env python
import time
def main():
exit()
def exit():
input = raw_input("Exit? Yes[y] or No[n] ")
if input == 'y':
print 'Exiting program...'
time.sleep(2)
elif input == 'n':
main()
elif input == 'yes':
print 'Your answer isn\'t right \nBut it\'s okay.'
time.sleep(2)
elif input == 'no':
main()
else:
print 'Please answer the question'
exit()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment