demo_ref_keyword_try.py:
try: x > 3 except: raise Exception("Something went wrong") print("The program stops when an error is raised.")
C:\Users\My Name>python demo_keyword_try.py
Traceback (most recent call last):
File "demo_ref_keyword_try.py", line 4, in <module>
raise Exception("Something went wrong")
Exception: Something went wrong