anonymous
  • anonymous
Hey I'm on pset4 problem 4 and I don't know how to implement the guessing procedure into the script please help. Here is what I have so far http://dpaste.com/hold/528870/ .
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
jamiebookeater
  • jamiebookeater
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
I used the bisection method of successive approximation that was taught in one of the lectures. According to this method, you set a high and low value for the expenses and guess half way in between. The code will look something like this: high = savings low = 0 expenses = (high + low) / 2 If your guess is too high, then you know the right answer must be somewhere between your guess and 0, so expenses becomes the new upper bound: high = expenses Likewise, if a guess is too low, expenses becomes the lower bound for the next guess, and you repeat this process until you get a result whose absolute value is less than epsilon, which means you will probably have to use a while-loop involving epsilon: while abs(final_result) > epsilon: expenses = (high + low) / 2 etc....
anonymous
  • anonymous
O thanks for actually replying and sorry for not going back and saying this earlier but i reposted my question and people helped me. Thanks anyway though.

Looking for something else?

Not the answer you are looking for? Search for more explanations.