Last active
June 29, 2023 10:53
-
-
Save AlgorithmAlchemy/09160926c94d3fb6e33237bc0ef5d3ea to your computer and use it in GitHub Desktop.
try count loop
This file contains hidden or 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 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