Context Managers and Decorators

Write a Context Manager with contextlib

① Learn

A context manager controls setup and cleanup around a with block. @contextmanager from contextlib is a simple way to write one.

② Implement — write it, run it, submit
Goal

Define `tag()` so `with tag() as value:` makes `value` equal `ready`.

Output
Hints
  • Stuck? Reveal a hint.
Free Tools & Calculators