<jupyter_start><jupyter_text>Python Reference - Exceptions**Author:** <NAME> Definition Links  syntax: try - except - finally<jupyter_code>try:
    x: int = 0
    y: int = 5/x
except ZeroDivisionError as e:
    print("Can not divide by zero")
except Exception as ex:
    print(f"Exception thrown: {ex}")
finally:
    print(f"y = {y}")<jupyter_output>Can not divide by zero
y = 5e-97<jupyter_text>create your own exception<jupyter_code>class InvalidEmailError(Exception):
    pass

def send_mail(email, subject, content):
    if not "@" in email:
        raise InvalidEmailError("email does not contain an @")
        
try:     
    send_mail("addr", "subj", "cont")
except InvalidEmailError as e:
    print(f"Please enter a valid e-mail address => {e}")<jupyter_output>Please enter a valid e-mail address => email does not contain an @
{'fraction_non_alphanumeric': 0.11497005988023952, 'fraction_numerical': 0.005988023952095809, 'mean_word_length': 4.097560975609756, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '215598', 'license': 'MIT', 'n_tokens_mistral': 277, 'n_tokens_neox': 273, 'n_words': 85, 'path': 'OOP/Exceptions.ipynb', 'repo_name': 'Architect0711/PythonReference', 'size': '843'}