24 out of 25 users completed this Bite ...
Will you be Pythonista #25 to crack this Bite?
Average Bite difficulty 1-10 rating: 4.6
» Up for a challenge? 💪
Write a context manager to roll back a transaction on the given
There are two special (aka dunder) methods you need to define to create a context manager (there is also a convenient decorator - see Bite 88).
The purpose of the context manager is to roll back any transaction that will make the balance go below 0 (debt != cool). The rest of the class is already defined so you can focus on the context manager part.
See the tests for more detail. Good luck and keep calm and code in Python!