Medium
Nested Depth Counter
Write a class
Level with a class attribute depth = 0; __enter__ increases it and prints enter DEPTH, __exit__ prints exit DEPTH and decreases it. Read n and nest n with Level(): blocks using a recursive function.Input
One integer n ≥ 1.
Output
2n lines.
Sample 1
Input
2
Output
enter 1 enter 2 exit 2 exit 1
Sample 2
Input
1
Output
enter 1 exit 1
Output appears here