QuestionQ88

VerifiedMiscellaneous (List Comprehensions, Lambdas, Closures, I/O)

Assuming the following code has executed successfully, select the expressions that evaluate to True.

Question Image

Choose three
Explanation

Both calls to f() update the same global var, leaving it equal to 3. Each returned g function reads that global value, so both a() and b() return 3; a is also a function object and therefore is not None. Each call to f() creates a separate g function object, so a is b is false. Consequently, three expressions evaluate to true despite the instruction to choose two.

Community Discussion

No comments yet. Be the first to start the discussion!