← Quiz: Context Managers: all 10 questions
Quiz: Context Managers · Question 3 of 10
In with Thing() as t:, what is stored in t?
In with Thing() as t:, what is stored in t?
- A.Always the Thing object itself
- B.Whatever Thing().enter() returns
- C.The return value of exit
- D.None
Answer & explanation
Correct answer: Whatever Thing().enter() returns
Often enter returns self, but it can return anything.
Can you get the rest right without peeking?
Take the timed Quiz: Context Managers quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →