Created
February 25, 2017 16:27
-
-
Save noveoko/1d3bd93a711c3b300dae44f6e386ad93 to your computer and use it in GitHub Desktop.
A class that manages a financial account
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): | |
self.owner = owner | |
self.balance = balance | |
def changeCountry(self, newCountry): | |
self.owner['country'] = newCountry | |
def clientReport(self): | |
print('START CR') | |
aData = [self.owner['first_name'], | |
self.owner['last_name'], | |
self.owner['address'], | |
self.owner['country'], | |
self.owner['DOB'], | |
self.balance['current_balance'], | |
self.balance['previous_balance'], | |
self.balance['interest_rate']] | |
print(len(aData)) | |
report = ''' | |
First Name {0} | |
Last Name {1} | |
Street {2} | |
Country {3} | |
DOB {4} | |
============= | |
Balance {5} | |
Last Bal {6} | |
Int. Rate {7}'''.format( | |
aData[0],aData[1],aData[2],aData[3],aData[4],aData[5],aData[6],aData[7]) | |
print(report) | |
BK23 = account({'first_name':'John', | |
'last_name':'Smith', | |
'address':'122 W. Main Street', | |
'state':'WI', | |
'country':'United States', | |
'SSN':'1103', | |
'CStatu':'US Citizen', | |
'DOB':'12-30-1976', | |
}, | |
{'current_balance':2343.03, | |
'previous_balance':2103.00, | |
'interest_rate':0.3, | |
'interest_period':'perAnnum' | |
}) | |
print(BK23.clientReport()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment