Skip to content

Instantly share code, notes, and snippets.

@solen003
Created August 7, 2018 10:52
Show Gist options
  • Save solen003/847160c4edd1c1427040faeb372c4c73 to your computer and use it in GitHub Desktop.
Save solen003/847160c4edd1c1427040faeb372c4c73 to your computer and use it in GitHub Desktop.
bankaccount.py
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