L Lê Minh Member Sep 20, 2021 #1 What will be the output of the following Python code? Code: def foo(): try: print(1) finally: print(2) foo() A. 1 2 B. 1 C. 2 D. none of the mentioned
What will be the output of the following Python code? Code: def foo(): try: print(1) finally: print(2) foo() A. 1 2 B. 1 C. 2 D. none of the mentioned
T Trần Vũ New member Sep 20, 2021 #2 Answer: a Explanation: No error occurs in the try block so 1 is printed. Then the finally block is executed and 2 is printed. Upvote 0 Downvote
Answer: a Explanation: No error occurs in the try block so 1 is printed. Then the finally block is executed and 2 is printed.