Home ยป Programming Language (coding) ยป Python MCQs ยป What is the output of the following code? def foo(): try: print(1) finally: print(2) foo()

What is the output of the following code? def foo(): try: print(1) finally: print(2) foo()

What is the output of the following code?

def foo():
    try:
        print(1)
    finally:
        print(2)
foo() 

A. 1 2
B. 1
C. 2
D. none of the mentioned

Correct Answer: Option A. 12 

Take Part in Discussion:

Your email address will not be published.

Solve : *
24 ⁄ 6 =