- 4

doubt

####Now write a program that calculates the minimum fixed monthly payment needed in order pay off a credit card balance within 12 months. By a fixed monthly payment, we mean a single number which does not change each month, but instead is a constant amount that will be paid each month. #### ####In this problem, we will not be dealing with a minimum monthly payment rate. #### ####The following variables contain values as described below: #### ####balance - the outstanding balance on the credit card #### ####annualInterestRate - annual interest rate as a decimal ##Assume that the interest is compounded monthly according to the balance at the end of the month (after the payment for that month is made). The monthly payment must be a multiple of $10 and is the same for all months. Notice that it is possible for the balance to become negative using this payment scheme, which is okay. A summary of the required math is found below: ## ##Monthly interest rate = (Annual interest rate) / 12.0 ##Monthly unpaid balance = (Previous balance) - (Minimum fixed monthly payment) ##Updated balance each month = (Monthly unpaid balance) + (Monthly interest rate x Monthly unpaid balance) balance =4773 annualInterestRate =0.2 monthlyInterestRate = annualInterestRate/12.0 minfixedmonthlypay =0 while balance >= 0 : balance = 4773 num_months = 0 while num_months <12: balance = balance - minfixedmonthlypay balance = balance + monthlyInterestRate*balance num_months += 1 minfixedmonthlypay += 1 print("Lowest Payment:",str(minfixedmonthlypay)) ####the outputs are not correct I think the problem lies in the condtioning of the while loop but am not sure ? The problem is supposed to return a monthly fixed payment so that credit card bill can be cleared in a year.

23rd Jul 2018, 10:44 AM
Arunava Sarkar
Arunava Sarkar - avatar
2 Réponses
+ 1
This is not a question, please remove it from the Q&A section. And check out the guidelines while you're at it. Cheers. https://www.sololearn.com/discuss/1316935/?ref=app
23rd Jul 2018, 10:51 AM
Tony
Tony - avatar
+ 1
to be a little more helpful, why dont you write your code up in the code playground and attach it to a question being more descriptive, with code its not just seeing the program but seeing the result itself to be able to accurately debug it. id be more than happy to help if you follow the steps i mentioned.
23rd Jul 2018, 11:38 AM
StealthyTaco
StealthyTaco - avatar