Skip to content

Instantly share code, notes, and snippets.

@Kevnlan
Forked from jimmykurian/BankAccount.py
Created July 16, 2016 06:03
Show Gist options
  • Save Kevnlan/501d7a02cf9edbe3b633df2b412240b9 to your computer and use it in GitHub Desktop.
Save Kevnlan/501d7a02cf9edbe3b633df2b412240b9 to your computer and use it in GitHub Desktop.
A BankAccount program with classes, written in Python.
# BankAccount.py - Jimmy Kurian
class BankAccount(object):
def __init__(self, initial_balance=0):
self.balance = initial_balance
def deposit(self, amount):
self.balance += amount
def withdraw(self, amount):
self.balance -= amount
def overdrawn(self):
return self.balance < 0
my_account = BankAccount(15)
my_account.withdraw(5)
print my_account.balance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment