LearnPy Hub
← Context Managers problems
Medium

closing()

Write a class Conn with a close() method that prints closed and a query(q) method returning q reversed. Use contextlib.closing to run the query from the input and close the connection.

Input

One line.

Output

Two lines.

Sample 1

Input
select
Output
tceles
closed

Sample 2

Input
abc
Output
cba
closed
solution.py
Output appears here
closing() · Python practice problem · LearnPy Hub