<jupyter_start><jupyter_text>Errors and Exceptions Homework  Problem 1Handle the exception thrown by the code below by using try and except blocks.<jupyter_code>for i in ['a','b','c']:
    try:
        print(i**2)
    except:
        print("unsupported operand type(s) for ** or pow(): 'str' and 'int'")<jupyter_output>unsupported operand type(s) for ** or pow(): 'str' and 'int'
unsupported operand type(s) for ** or pow(): 'str' and 'int'
unsupported operand type(s) for ** or pow(): 'str' and 'int'<jupyter_text>Problem 2Handle the exception thrown by the code below by using try and except blocks. Then use a finally block to print 'All Done.'<jupyter_code>x = 5
y = 0
try:
    z = x/y
except:
    print('ZeroDivisionError')
finally:
    print('All Done.')<jupyter_output>ZeroDivisionError
All Done.<jupyter_text>Problem 3Write a function that asks for an integer and prints the square of it. Use a while loop with a try, except, else block to account for incorrect inputs.<jupyter_code>def ask():
    while True:
        try:
            val = int(input("Input an integer: "))
        except:
            print("An error occurred! Please try again!")
        else:
            print(f'Thank you, your number squared is:  {val**2}')
            break
    
ask()<jupyter_output>Input an integer: null
An error occurred! Please try again!
Input an integer: 2
Thank you, your number squared is:  4
{'fraction_non_alphanumeric': 0.1072961373390558, 'fraction_numerical': 0.006437768240343348, 'mean_word_length': 3.55700325732899, 'pattern_counts': {'":': 0, '<': 10, '<?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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '109295', 'license': 'MIT', 'n_tokens_mistral': 443, 'n_tokens_neox': 432, 'n_words': 170, 'path': 'task_03/02-Errors and Exceptions Homework.ipynb', 'repo_name': 'IraqiAseed/DS_Assignment_06', 'size': '1398'}