Skip to content

Instantly share code, notes, and snippets.

@ithayer
Created July 3, 2011 02:53
Show Gist options
  • Select an option

  • Save ithayer/1061911 to your computer and use it in GitHub Desktop.

Select an option

Save ithayer/1061911 to your computer and use it in GitHub Desktop.
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