LearnPy Hub
← Context Managers problems
Easy

@contextmanager

Write a @contextmanager function section(title) that prints == TITLE == before the block and == end == after. Print each word of the second input line inside the block.

Input

A title, then a line of words.

Output

Lines.

Sample 1

Input
Fruits
apple mango
Output
== Fruits ==
apple
mango
== end ==

Sample 2

Input
X
y
Output
== X ==
y
== end ==
solution.py
Output appears here
@contextmanager · Python practice problem · LearnPy Hub