Python: Why can't I insert print statements to debug this?
Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
balance = 320000
annualInterestRate = 0.2
for count in range(12):
print('Lowest Payment: '+str(round(payment, 2)))
the output is coming out too high, but I can't debug it because it only will let me put print statements in at the end for some reason. I would like to put one up between lines 9 and 10 to track the balance, and another at the end to track payment. Any ideas?
Why can't you debug? I'm not too sure about Python nor the editor you are using, but if you want to do things like debug you will need a good IDE, which I also recommend. I'll take a look later to see if I find a mistake tho.
Not the answer you are looking for? Search for more explanations.
high=balance*(1+monthlyInterestRate)**12/12.0 what's this **?
Also I would surround by brackets if that is what should happen. (balance*(1+monthlyInterestRate)**12)/12??
I mean I shouldn't have to tell a math wizz like you that, so I'm assuming you did this on purpose, but who knows... that ** is something I'm more konfused about :P
The program is to use bisection search to find the minimum monthly payment required to pay off some debt "balance" within one year
this is the maximum yearly payment could be imagining we didn't pay off anything at any month and the interest accrues by a factor of 1+monthlyInterestRate each month, then the monthly payment is given by dividing by 12 months.
And yeah, I tried the parentheses bit.
what is an IDE ?
** raises to a power btw
IDE = Integrated Development Environment
Problem solved, I had all sorts of horrible things going on. the worst being that I defined
at the beginning, so the next line
was never true, so the thing wasn't even running the body of the program :P
I won't type the corrected program as it is an answer to the MITx thing, but I did get it :)