edX MIT 6.00.1x 2020 Introduction to Computer Science and Programming Using Python
Week 2: Simple Programs: Problem Set 2 Problem 1 Solution
Problem 1 - Paying Debt off in a Year
Write a program to calculate the credit card balance after one year if a person only pays the minimum monthly payment required by the credit card company each month.
The following variables contain values as described below:
balance - the outstanding balance on the credit card
annualInterestRate - annual interest rate as a decimal
monthlyPaymentRate - minimum monthly payment rate as a decimal
For each month, calculate statements on the monthly payment and remaining balance. At the end of 12 months, print out the remaining balance. Be sure to print out no more than two decimal digits of accuracy - so print
Remaining balance: 813.41
instead of
Remaining balance: 813.4141998135
So your program only prints out one thing: the remaining balance at the end of the year in the format:
Remaining balance: 4784.0
A summary of the required math is found below:
Monthly interest rate= (Annual interest rate) / 12.0
Minimum monthly payment = (Minimum monthly payment rate) x (Previous balance)
Monthly unpaid balance = (Previous balance) - (Minimum 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 #Problem1 #Answers #Introduction #ComputerScience #CS #Programming #Computer #Science #CS #IT #AI #ICT #Code #Practice #Online #Coding #Classes #Python3.9 #Beginners