LearnPy Hub
← Context Managers problems
Medium

Temporary Setting

SETTINGS = {'mode': 'normal'}. Write a context manager temp_mode(m) that sets the mode and restores the old one afterwards. Print the mode before, inside and after.

Input

One word.

Output

Three lines.

Sample 1

Input
exam
Output
normal
exam
normal

Sample 2

Input
dark
Output
normal
dark
normal
solution.py
Output appears here
Temporary Setting · Python practice problem · LearnPy Hub