Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started