Medium
An Async Context Manager
Write a class
Connection with async def __aenter__ (prints connect NAME, returns self) and async def __aexit__ (prints close NAME). In main(), for each input name use async with Connection(name) as c: and print using NAME inside.Input
Names separated by spaces.
Output
Lines.
Sample 1
Input
db
Output
connect db using db close db
Sample 2
Input
db cache
Output
connect db using db close db connect cache using cache close cache
Output appears here