Question: Problem 1 Handle the exception thrown by the code below by using try and except blocks. In [1]: for i in ('a','b', 'c']: print(i**2) TypeError

 Problem 1 Handle the exception thrown by the code below by

using try and except blocks. In [1]: for i in ('a','b', 'c']:

Problem 1 Handle the exception thrown by the code below by using try and except blocks. In [1]: for i in ('a','b', 'c']: print(i**2) TypeError Traceback (most recent call last) in () 1 for i in ['a', 'b', 'c']: ----> 2 print(i**2) TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int' Problem 2 Handle the exception thrown by the code below by using try and except blocks. Then use a finally block to print 'All Done.' In [2]: x = 5 y = 0 z = x/y ZeroDivisionError Traceback (most recent call last) in () 2 y = 0 3 ----> 4 Z = x/y ZeroDivisionError: division by zero Problem 3 localhost:8888otebooks/Documents/Computer Programming I/Complete-Python/07-Errors and Exception Handling/Errors and Exceptions Homewor... 1/2 1/4/2021 Errors and Exceptions Homework - Jupyter Notebook Write 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. In [3]: def ask(): pass In [4]: ask() Input an integer: null An error occurred! Please try again! Input an integer: 2 Thank you, your number squared is: 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!