Last active
May 2, 2021 20:22
-
-
Save ofelix03/4278913942f7b9e962fc549098d8d172 to your computer and use it in GitHub Desktop.
atm-class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ATM(object): | |
| @classmethod | |
| def _authenticate(cls, pin): | |
| # perform PIN verification and authentication | |
| return True | |
| @classmethod | |
| def withdraw_money(cls, pin, amount): | |
| if not cls._authenticate(pin): | |
| raise InvalidPin('Wrong PIN') | |
| cls.process_request(pin, amout) | |
| @classmethod | |
| def process_request(self, amount): | |
| # perform proess to withdraw money | |
| pass | |
| # Method invocation to withdraw money | |
| ATM.withdraw_money('1234', 20000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment