Skip to content

Instantly share code, notes, and snippets.

@Deathcrash
Last active June 29, 2023 10:53
Show Gist options
  • Save Deathcrash/09160926c94d3fb6e33237bc0ef5d3ea to your computer and use it in GitHub Desktop.
Save Deathcrash/09160926c94d3fb6e33237bc0ef5d3ea to your computer and use it in GitHub Desktop.
try count loop
import time
error = 0
while True:
time.sleep(1)
try:
if error == 0:
i = input("input good or bad if ")
if i == "good":
error = 0
print("nice if")
elif i == "bad":
error = 0
print("bad if")
raise Exception("Some exception ")
elif error == 1:
i = input("input good or bad elif ")
if i == "good":
error = 0
print("nice elif")
elif i == "bad":
print("bad elif")
error = 0
raise Exception("Some exception ")
except:
print("except error")
error = 1
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment