Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 17 Online
OpenStudy (anonymous):

Can somebody assist me in problem set 1? its for the first problem....(credit of $5K) ...I don't get the part to use the for loop, range, and count for each month....

OpenStudy (anonymous):

Here's what I have so far....but my problem is that it won't update the values for the remaining balance and what not......?????? your help is greatly appreciated! Balance = float(input('What is your outstanding balance on your credit card?')) monthly_payment = .02 * Balance interest_paid = .18/12.0 * Balance principle_paid = monthly_payment - interest_paid remaining_balance = Balance - principle_paid for count in range (1,13): remaining_balance = Balance - principle_paid monthly_payment = .02 * remaining_balance interest_paid = .18/12.0 * remaining_balance print 'Interest paid:', interest_paid print 'Minimum monthly payment:', monthly_payment print 'Principle paid:', principle_paid print 'remaining_balance:' , remaining_balance print 'Enter the annual credit card interest rate as a decimal:.2' print 'Enter the minimum monthly payment rate as a decimal: .02' print 'Month:' , count

OpenStudy (e.mccormick):

I am not sure what your indenting is supposed to be. That is where the \(\text{```}\) thing from the other question you commented on comes in. Pastebin or dpaste also work really well for this.

OpenStudy (anonymous):

ahhhh okay sorry about that e.mccormick....not sure what happened there with my indentation.... Balance = float(input('What is your outstanding balance on your credit card?')) monthly_payment = .02 * Balance interest_paid = .18/12.0 * Balance principle_paid = monthly_payment - interest_paid remaining_balance = Balance - principle_paid for count in range (1,13): remaining_balance = Balance - principle_paid monthly_payment = .02 * remaining_balance interest_paid = .18/12.0 * remaining_balance print 'Interest paid:', interest_paid print 'Minimum monthly payment:', monthly_payment print 'Principle paid:', principle_paid print 'remaining_balance:' , remaining_balance print 'Enter the annual credit card interest rate as a decimal:.2' print 'Enter the minimum monthly payment rate as a decimal: .02' print 'Month:' , count i'll use pastebin....thanks for the tip!!!!! greatly appreciated!

OpenStudy (anonymous):

This way you have to enter your balance, intrest etc witin the for loop, while these figures are only requested at the start (of a year)

OpenStudy (anonymous):

The print statements with the prhase 'Enter....", are not input statements, where you do need the input (and you need theme at the start of the program They should also be float(raw_input(....) statements

OpenStudy (anonymous):

if these two are also given as an input, you need to use it instead of the numbers 0.2 and o.18 you use in the for-loop They have to be calculated from the entered values

OpenStudy (anonymous):

I take it that you intent to do ps1 problem 1

OpenStudy (anonymous):

So with minimal changes (print instead of inputs, you can change that later on ``` Balance = float(input('What is your outstanding balance on your credit card?')) print 'Enter the annual credit card interest rate as a decimal:.2' print 'Enter the minimum monthly payment rate as a decimal: .02' monthly_payment = .02 * Balance interest_paid = .18/12.0 * Balance principle_paid = monthly_payment - interest_paid Balance = Balance - principle_paid for count in range (1,13): # you had # remaining = Balance - principle_paid remaining_balance = remaining_balance - principle_paid monthly_payment = .02 * remaining_balance interest_paid = .18/12.0 * remaining_balance print 'Interest paid:', interest_paid print 'Minimum monthly payment:', monthly_payment print 'Principle paid:', principle_paid print 'remaining_balance:' , remaining_balance print 'Month:' , count ``` You will have to change the print statements at the start and use variables instead of numbers to make it more general later on

OpenStudy (anonymous):

@roderick_camarce

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!