edX MIT 6.00.1x 2020 Week 2: Simple Programs Problem Set 2 Problem 2

Published: 23 June 2020
on channel: Python Gurgaon
591
6

edX MIT 6.00.1x 2020 Introduction to Computer Science and Programming Using Python

Week 2: Simple Programs: Problem Set 2 Problem 2 Solution

Problem 2 - Paying Debt Off in a Year

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

The program should print out one line: the lowest monthly payment that will pay off all debt in under 1 year, for example:

Lowest Payment: 180

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)

Step by step process. Practice by writing the code yourself.

Chapter 2 Python Revision Tour 2, Grade 12 CS (083) CBSE Solutions Sumita Arora 2020-21
   • Chapter 2 Python Revision Tour II Gra...  

Chapter 1 Python Revision Tour Grade 12 CS (083) CBSE Solutions Sumita Arora 2020-21
   • Chapter 1 Python Revision Tour Grade ...  

Python Tutorial For Beginners    • Python Tutorial for Beginners  

#Python #MIT #edX #6.00.1x #2020 #Solutions #Week2 #Simple #Programs #ProblemSet2 #Problem2 #Answers #Introduction #ComputerScience #CS #Programming #Computer #Science #CS #IT #AI #ICT #Code #Practice #Online #Coding #Classes #Python3.9 #Beginners