I swear, those things are like shurikens in these masses...
I'm trying to make a loan calculator in python, as part of an assignment. I'm basing it off of two things.
1: This website, which contains 3 different calculators.
2: The link from the second calculator (my current pain)
I'm going to have a panic attack, I swear... So many parentheses.
I had to manually derive for the Newton-Raphson portion... and of course, now I have so many frekaing parentheses that I can't tell what the heck I'm doing... I mean, sure, I might be a little parenthesis-happy, but I'm new to this and I want to make sure my groupings are all correct...
def findInterestRate():
loanAmount = raw_input("Please enter the loan amount: ")
monthlyPayment = raw_input("Please enter the monthly payment: ")
numberMonths = raw_input("Please enter the number of months: ")
# YAY complications.
finderGuess = (2((numberMonths*monthlyPayment)-loanAmount))/(numberMonths*monthlyPayment)
while zeroFindings != 0:
zeroFindings = ((finderGuess*((1+finderGuess)^numberMonths))/(((1+finderGuess)^numberMonths)-1))-(monthlyPayment/loanAmount)
if ziggy == 1 and zeroFindings != 0:
# now to show off the x~k+1 = x~k - f(x~k)/f`(x~k)
# Yes, the ~ denotes the subscript with the k.
finderGuess = finderGuess - ((((finderGuess*((1+finderGuess)^numberMonths))/(((1+finderGuess)^numberMonths)-1))-
(monthlyPayment/loanAmount))/(((((1+finderGuess)^numberMonths)-1)
(finderguess*(numberMonths*((1+finderGuess)^(numberMonths-1)))+
(1+finderGuess)^((finderGuess*(1+finderGuess)^numberMonths)*
(numberMonths*((1+finderGuess)^(numberMonths-1)))))/
((((1+finderGuess)^numberMonths)-1)^2))))
ziggy = 1
answer = finderGuess
print "Your interest rate should be: " + str(answer)
Rabblerousers I hate this whole enters thing with parentheses... only way I can see it all in the window...
Takes up a whole freaking lot...
Does little to soothe my pains...
...
Can I get at least one person to help me double-check this, I feel like I'm missing things.
Especially after realizing that I had accidentally hit control+backspace at one point and it erased a small portion at one spot... which means I might have done it multiple times...
And of course, I'm hoping and praying that I get this fixed as I know this will bite my rear in the end if I messed this part up of all things.
Edit: It would be nice if the GUI had color-coded parentheses, to show groupings... or better yet, shading of a similar method...