LearnPy Hub
← Context Managers problems
Easy

Hello and Goodbye

Write a class Visit whose __enter__ prints hello and __exit__ prints goodbye. In a with Visit(): block print the input line.

Input

One line.

Output

Three lines.

Sample 1

Input
nice to meet you
Output
hello
nice to meet you
goodbye

Sample 2

Input
Python
Output
hello
Python
goodbye
solution.py
Output appears here
Hello and Goodbye · Python practice problem · LearnPy Hub