Created
July 3, 2011 02:53
-
-
Save ithayer/1061911 to your computer and use it in GitHub Desktop.
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
| def solve(eq,var='x'): | |
| eq1 = eq.replace("=","-(")+")" | |
| c = eval(eq1,{var:1j}) | |
| return -c.real/c.imag | |
| class CalculatorHandler: | |
| def __init__(self): | |
| self.log = {} | |
| def add(self, MP, P): | |
| global summation | |
| global numberOfCs | |
| c=[] | |
| print 'add..' | |
| # I assumed interest rates are between 0 and 30 | |
| for i in range(1,30): | |
| r=i | |
| temp=((100*(MP/P))-(r/12)) | |
| if temp>0: | |
| c.append((100*(MP/P))-(r/12)) | |
| numberOfCs+=1 | |
| summation=summation+sum(c) | |
| return summation/numberOfCs | |
| def getStruct(self, key): | |
| print 'getStruct(%d)' % (key) | |
| return self.log[key] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment