I'm learning to code in python and I created a code to calculate the amount of a debt its compound interest and the instalments to pay the debt. The code works fine with small amounts but if I go over 10k with the debt the program gets into an infinite loop, can anyone help?
Code below:
print('Debt')
a = float(input('Debt amount: $ '))
b = float(input('interest rate: % '))
c = float(input('monthly instalment: R$ '))
b /= 100
x = 0
div = a
ttp = 0
while div > 0:
inte = div*b
div = (div + inte) - c
x += 1
ttp = (c*x) + div
print ('The total of months to pay out the debt was: %d\nThe total paid was: R$%.2f ' % (x, ttp))
print('The total paid in interest was: $ %.2f' % (ttp-a))