Question 14
Back to Exercise
What is the output of the following Python program?
x = 10
f = lambda: x
g = lambda x=x: x
x = 20
print(f(), g())
- A 10 10
- B 20 20
- C 20 10 Correct
- D 10 20
Correct Answer: Option C
f looks up x when called (20). g's default was evaluated when g was created (10).
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!