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

This Question is Closed

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0because 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.

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0That'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
 3 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!:)

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

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

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

anonymous
 3 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

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0Guys... 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
 3 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.

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0If 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)

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

anonymous
 3 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
 3 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?.

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0It 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.

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

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0@MicroBot what ?? I did not get you.

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

MicroBot
 3 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
 3 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

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

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

MicroBot
 3 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
 3 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!

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

MicroBot
 3 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
 3 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

anonymous
 3 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.

anonymous
 3 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

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0Good keep it up.. you will get you answer soon.

MicroBot
 3 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!

anonymous
 3 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

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0Solve it on paper first!

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

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0Come 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!

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

MicroBot
 3 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.....

anonymous
 3 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

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

MicroBot
 3 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?

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

anonymous
 3 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
 3 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.

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0still you have not got the output? may I help u.?

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

anonymous
 3 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
 3 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.

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

anonymous
 3 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
 3 years ago
Best ResponseYou've already chosen the best response.0how about smthing like this?: target_balance=balance

MicroBot
 3 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.

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

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

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0ok. so you are talking about why are you getting 30.5 rgt?

anonymous
 3 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
 3 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
 3 years ago
Best ResponseYou've already chosen the best response.0because u set balance=balance

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

MicroBot
 3 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
 3 years ago
Best ResponseYou've already chosen the best response.0u can set it to as i wrote above*

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0ok 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..

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0Hope that rings a bell for you.

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

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0@MicroBot you know the solution rgt?

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0you know that where he is doing the mistake?

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

MicroBot
 3 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!

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

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

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0yeap you are right. @MicroBot

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

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

MicroBot
 3 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.

anonymous
 3 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

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

MicroBot
 3 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.