Question: Q5.(a). The following code executes without any errors. Provide 3 variants of the code having an error which runs each of the exceptions mentioned within

Q5.(a). The following code executes without any errors. Provide 3 variants of the code having an error which runs each of the exceptions mentioned within the code. (6-Marks) try: def fun1(a,b): print(a,b) in_file = open('input_file.txt', 'w') in_file.write('nothing') x = 2 y = x+2 fun1(2,3) except FileNotFoundError: print("File doesn't exist") except NameError: print('Variable Undeclared') except SyntaxError: print('non-default argument follows default argument')

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!