Created
August 7, 2018 10:52
-
-
Save solen003/847160c4edd1c1427040faeb372c4c73 to your computer and use it in GitHub Desktop.
bankaccount.py
This file contains 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 Account(): | |
def __init__(self, owner, balance=0): | |
self.owner = owner | |
self.balance = balance | |
def deposit(self, deposit_amt): | |
self.balance += deposit_amt | |
print(f'Hello {self.owner}') | |
print(f'Deposit of {deposit_amt} processed') | |
print(f'Your balance is {self.balance}') | |
def withdrawal(self, withdrawal_amt): | |
print(f'Hello {self.owner}') | |
if withdrawal_amt > self.balance: | |
print('Not enough funds') | |
else: | |
self.balance -= withdrawal_amt | |
print(f'Withdrawal of {withdrawal_amt} processed') | |
print(f'Your balance is {self.balance}') | |
def __str__(self): | |
return f'Owner of the account is {self.owner}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment