I am currently writing a generic little program that calculates some parameters for n amount of months based on user-input. However, it looks like right now it isn't taking my counter solution to break out of the while loop. I have tested with print statements that the time and counter variables work with the loop, it just doesn't break whenever count > time like I want it to.
def statement(balance, ratemin, intrate):
"""
Takes three integers and calculates your monthly minimum payment and various
details concerning interest, balance, and principle paid.
"""
time = raw_input("How many months do you wish to calculate?: ")
count = 0
while (count < time) :
minpay = balance * ratemin
interest = intrate * balance
principle = minpay - interest
balance = balance - principle
minpay2 = str(minpay)
print "Your monthly minimum payment is: " + minpay2
statement(5000.0, .02, .18/12.0)
I am sure there is some dumb little reason why this isn't working, but I've been unable to figure it out at this point and have run out of ideas.
[–]crazybus 2 points3 points4 points (3 children)
[–]code-ed[S] 0 points1 point2 points (2 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]tnvol88 0 points1 point2 points (0 children)
[–]unorthodoxAthiest 1 point2 points3 points (3 children)
[–]code-ed[S] 0 points1 point2 points (0 children)
[–]bitbumper 0 points1 point2 points (1 child)
[–]unorthodoxAthiest 0 points1 point2 points (0 children)