-
-
Save Kevnlan/501d7a02cf9edbe3b633df2b412240b9 to your computer and use it in GitHub Desktop.
A BankAccount program with classes, written in Python.
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
# 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