LearnPy Hub
← Context Managers problems
Easy

Start and End Messages

Write class Section whose __enter__ prints start NAME and __exit__ prints end NAME. Read a name and a message; inside with Section(name): print the message.

Input

Two lines.

Output

Three lines.

Sample 1

Input
intro
hello
Output
start intro
hello
end intro

Sample 2

Input
x
y
Output
start x
y
end x
solution.py
Output appears here
Start and End Messages · Python practice problem · LearnPy Hub