← Quiz: Context Managers: all 10 questions
Quiz: Context Managers · Question 2 of 10
Which two methods make an object a context manager?
Which two methods make an object a context manager?
- A.init and del
- B.iter and next
- C.enter and exit
- D.open and close
Answer & explanation
Correct answer: enter and exit
enter runs at the start and exit at the end of the with block.
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 →