A community for students.
Here's the question you clicked on:
 0 viewing

This Question is Closed

rambo2210
 2 years ago
Best ResponseYou've already chosen the best response.1because first while loop is continuestly exicuting: while(balance > 0): balance = 4213 mmp += 10 it will never come out. balance value will never get down to 0.

Chris2332
 2 years ago
Best ResponseYou've already chosen the best response.1That's not correct. It has nothing to do with the outer loop. It has to do with the fact that on the second iteration of the outer loop, the "m" variable is not reset. Therefore the second while loop is not executed! What he is doing, by resetting the balance is totally correct!

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0What @Chris2332 says is very right! You have your inner while loop to repeat the months round. OK You have the iteration control variable ,set and changing.OK What you dont have, is that same variable reseting in your outter loop so that you can run it again on your next try to find the mmp. Means that ,on your next try ,where you have mmp raising you will have m=13 from your last iteration round and that will not enter inner while loop. Hope that helps!:)

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0I reset it but still no joy http://codepad.org/pZwfvY9j

Chris2332
 2 years ago
Best ResponseYou've already chosen the best response.1Why at the end of your inner loop are you resetting the mmp?

rambo2210
 2 years ago
Best ResponseYou've already chosen the best response.1No need to reset mmp. both the while loops are depend on blance and m values.

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0Of course, it is a throwback to the original from 1st problem when it was the minimum payment, but not needed on this

Chris2332
 2 years ago
Best ResponseYou've already chosen the best response.1Guys... I've said it a million times... solve the problem on paper and then move on to programming. If you don't understand the solution to the problem, how do you expect to write the code to solve it?

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0An other thing, not error generating ,but important : line 7 : u have inizialized m=1. OK but since you are doing this in the while loop ,there it is no more needed. HElps you keep your code cleaner and more readable.

rambo2210
 2 years ago
Best ResponseYou've already chosen the best response.1If you would like to run it once then try this code: balance = 4213 annualInterestRate = 0.2 monthlyPaymentRate = 0.04 monthlyInterestRate = annualInterestRate/12 mmp = 10 paid = 0 m = 1 if (balance !=0): balance = 4213 mmp += 10 while(m <=12): m += 1 balance = (balance  mmp)*(1 + monthlyInterestRate) paid = mmp + paid mmp = monthlyPaymentRate*balance print 'Total paid: ',round(paid,2) print 'Remaining balance: ',round(balance,2)

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0Yes that seems to work , Thanks

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0I am only a beginner so do not have much real world experience at thinking up methods

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0@rambo2210 mate seriously do you know you are not supposed to give out the answer before the PS is due?.

rambo2210
 2 years ago
Best ResponseYou've already chosen the best response.1It is very ok.:) feel free to ask you question here. BTW, I dont know phython. but I have programming skill so I could solve you problem.

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0Doesn't pass grader but I will keep trying

rambo2210
 2 years ago
Best ResponseYou've already chosen the best response.1@MicroBot what ?? I did not get you.

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0Doesn't pass grader though seems to work fine

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0you gave him the whole code and thats is not allowed ...he is supposed to resolve it alone....help is ok as we all need help to understand things but like this ..... From: https://www.edx.org/static/contentmit600x~2012_Fall/handouts/Collaboration_guidelines.7c42c319b037.pdf "It is not ok to post answers to lecture and problem set problems before the submission deadline."

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0@minimallinux keep trying mate!im sure you can do it you just need a clean head .What i do is when i resolve a step i had problem with...i take a break...do smthing different....dunno go make a tea or a coffe and the return to next problem i have!:) helps a lot

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0Seems others more experienced have problems with this one too

rambo2210
 2 years ago
Best ResponseYou've already chosen the best response.1@MicroBot Oops. I m really very sorry for this. I did not know this. Please forgive me.

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0Not for me to forgive you:) Just ppl have to keep in mind what is fair and what it not!:)

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0@minimallinux well i know whatis the problem but u have to promise me that you will spend time to understand the version that rambo gave you before sending it!

rambo2210
 2 years ago
Best ResponseYou've already chosen the best response.1@MicroBot from where I will find all this problems I also want to solve.

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0balance = 4213 annualInterestRate = 0.2 those 2 you mustnt initialize them as the EdX tester has its own way to give values to your variables. just delete it and send without it!

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0@rambo2210 check EdX page https://www.edx.org/dashboard MITx: 6.00x Introduction to Computer Science and Programming you have still time to start it and do in time the PS1 that is due on monday. GL

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0I already removed them before submitting, so I don't know why it fails, but anyway I have to try to go over it myself, just submitting something already done serves no purpose.

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0In fairness, the inner loop is my own code anyway, its just the outer loop, I probably wouldn't have got that at present

rambo2210
 2 years ago
Best ResponseYou've already chosen the best response.1Good keep it up.. you will get you answer soon.

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0Well mini if you believe that ,for loop is better or more understanding ,you sure can and should use it...its enough that you understand what you are writing. Thats all!

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0It is not right anyway, the program asks for the lowest payment which clears the balance, and the notes recommend using a while loop, I was probably on the right track previously

Chris2332
 2 years ago
Best ResponseYou've already chosen the best response.1Solve it on paper first!

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0This course is hard !

Chris2332
 2 years ago
Best ResponseYou've already chosen the best response.1Come on mate... it's the first couple of lectures...it's not hard. You just want to find a quick solution without understanding everything. Be focused and you ll be ok!

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0Yes, you are right, quick solution is no good

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0What @Chris2332 means, is that when you do it on paper ,1st you have infinite possibilities to edit and build and design and think over your code!When you write directly into the editor you are ,subconciously ,scared to make a mistake cause you would have a hard time retyping other things and this does not unfold your mind ...it does not let you concentrate on the problem but on the use of python.....

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0I find it hard to work out on paper as I have not presently sufficient knowledge t o ascertain what everything is going to do, but I will work on it. I have done a new version which comes up with the correct end result but does some strange things in the meantime like increasing the balance alarmingly before somehow correcting it Its here http://codepad.org/2gw0bTcD

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0Doesn't pass the checker

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.01st of all: (i know its only initialized not used anywhere but why u keep the monthlypayment rate in ur code anyway?

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0Thats left over from previous section needs to remove Thanks

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0Cant see why the balance goes up, print is there to check that, its not needed for checker

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0plus....remove all extra print outs....u have to have the output they ask u to have. ill check now about balance.

rambo2210
 2 years ago
Best ResponseYou've already chosen the best response.1still you have not got the output? may I help u.?

rambo2210
 2 years ago
Best ResponseYou've already chosen the best response.1can you just post the question here so that I can give some help.

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0Just done a new version which gives correct result but doesn't pass checker and does some strange things with the balance before seemingly fixing them http://codepad.org/spD9OZ1u

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0while(balance > 0): balance = 3926 this gives u the problem too as when u send it for checking no matter what they put to be balance ...u always set it to 3926....assign balance value to smthing else.

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0No in checker that is removed and not set as per usual

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0OK I see that I should set balance = balance in loop instead of 3926

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0how about smthing like this?: target_balance=balance

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0the fact that at start ur rem balance raises is that the 1st payment tests are too low and with the monthly interest rate added it goes up. so its normal.

rambo2210
 2 years ago
Best ResponseYou've already chosen the best response.1guys I have the sollution. but dont know how to show you that as @MicroBot told me not to post code here.

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0AT what area I should be looking at

rambo2210
 2 years ago
Best ResponseYou've already chosen the best response.1ok. so you are talking about why are you getting 30.5 rgt?

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0No we were talking about raised balances but that is normal, I took out the print statements and now I am getting the wrong outcome !! http://codepad.org/WezAh8ef (should be 360)

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0nop the problem says that it is normal to get a negative number as u r raising the payment by staps of 10.and i assure u it is legal for the checker aswell. what he asks is that ata start the remaining balance starts to become bigger instead of becoming lower .And that is normal too if u manually try to calculate the rem balance at low payment numbers.

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0because u set balance=balance

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0So I can set it to ?

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0I must be close to this now

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0u can say i wrote u above x=balance and use that as a new variable. or smthing = balance:)

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0u can set it to as i wrote above*

rambo2210
 2 years ago
Best ResponseYou've already chosen the best response.1ok so here is the hint. the problem is with 2nd loop. 2nd loop will run for 12 times rgt? and you are checking the condition after that loop. try using condition in side 2nd loop..

rambo2210
 2 years ago
Best ResponseYou've already chosen the best response.1Hope that rings a bell for you.

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0w8 sec stop everything u are doing xD

rambo2210
 2 years ago
Best ResponseYou've already chosen the best response.1@MicroBot you know the solution rgt?

rambo2210
 2 years ago
Best ResponseYou've already chosen the best response.1you know that where he is doing the mistake?

rambo2210
 2 years ago
Best ResponseYou've already chosen the best response.1I am getting the final print as follow: Remaining balance: 330 Lowest Payment: 360 Is it correct??

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0mini stop doing this exercise for 510 mins...go do smthing else that has nothing to do with programming....cause now while we give u a mill of hints and suggestions u r trying to figure it out with our heads not with urs...clean ur head and ull understand im sure..then return to it and see it with new eyes!please do so!

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0Yes will do its become confusing I was very close to this one

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0@rambo yes i do know the solution but he needs a break!

rambo2210
 2 years ago
Best ResponseYou've already chosen the best response.1yeap you are right. @MicroBot

rambo2210
 2 years ago
Best ResponseYou've already chosen the best response.1@MicroBot I am getting the final print as follow: Remaining balance: 330 Lowest Payment: 360 Is it correct??

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0I get 360 if i set balance = 3926 in inner loop

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0@rambo2210 based on his program im getting lowest payment 360 and rem balance 30.5...negative rem balance is fine for the solution.

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0having a rest for a bit this is what I've got http://codepad.org/FNCkLfJy

minimallinux
 2 years ago
Best ResponseYou've already chosen the best response.0but doesnt pass checker because of value 3926 in inner loop I beliave

MicroBot
 2 years ago
Best ResponseYou've already chosen the best response.0it is right but u have to adjust ur code to be readable by their checking program. ur program as it is now works only for balance =3926 unles u manualy change it from inside. (think of it as a user not a developer)
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.