Context Managers

Talk it through with a coach who asks guiding questions and gives hints until you reach the answer. Pass to mark the challenge as completed.

The problem

  • medium
  • Pro

Explain what Python's with statement does, why it's the right way to open files and locks, and how you'd write your own context manager for timing a block of code.

Talk this problem through with an AI coach

This is a Pro challenge. Sign in with Google, then upgrade to start a voice session.

Start free →