11 solutions available
Question 2Assertion (A): Exception handling code is separate from normal code.Reasoning (R): Program logic is different while exception handling code...
Question 3Assertion (A): Exception handling code is clear and block based in Python.Reasoning (R): The code where unexpected runtime exception may...
Question 1What all can be the possible outputs of the following code?def myfunc (x=None) : result = "" if x is None: result = "No...
Question 5How can you handle an exception in Python? Write sample code to illustrate it.
Question 6Name some common built-in exceptions in Python.
Question 7What does the finally clause produce in a try...except block?
Question 8Write syntax of raise statement.
Question 9Differentiate between IOError and IndexError.
Question 10Show how to modify the following code so that an error is printed if the number conversion is not successful:val = input("Enter a number")...
Question 11Consider the code given below and fill in the blanks with appropriate error types:loop = 1 while loop == 1: try: a =...
Question 4The order of exception handling in Python is try, followed by except, and then finally.