Credit card interest Write a Python program that determines
Credit card interest. Write a Python program that determines the num- ber of months required to payoff a credit card balance—assuming no other purchases are incurred on the card. You will need to import the math module for this program. In particular, you will find the math.log() function to be useful. (See the pictures for more instructions)
Consider the following variables.
• b = credit card balance
• n = number of months to payoff balance
• p = monthly payment (in dollars)
• r = effective (monthly) interest rate
Please, attach a picutre of your code so that I can see the indentation and write the code correctly.
Solution
Code:
b = int(input(\"Please enter the amount:\"))
r = int(input(\"Please enter the interest rate :\"))
p = int(input(\"Please enter monthly installment:\"))
rr = r/12
month = 1
print(\"# months Payoff Bal\")
while b>0:
print(\"%d \\t%d \"%( month, b))
interest = b*(rr/100)
b = (b + interest - p)
month += 1
Output:
