A community for students.
Here's the question you clicked on:
 0 viewing
anonymous
 5 years ago
So I did write a thing that successfully accomplishes what we were asked to do in question 2, but then I noticed the template provided has a for n in range thing... I have no idea how to incorporate that. I did it with a loop that would repeat every time the number of consecutive possible answers was less than the size of the smallest box...and I can't really see any other way of looking at it. Help?
anonymous
 5 years ago
So I did write a thing that successfully accomplishes what we were asked to do in question 2, but then I noticed the template provided has a for n in range thing... I have no idea how to incorporate that. I did it with a loop that would repeat every time the number of consecutive possible answers was less than the size of the smallest box...and I can't really see any other way of looking at it. Help?

This Question is Closed

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Here is the beginning of the Python Tutorial in the online documentation  section 4.2 and 4.3 talk about for and range file:///C:/Users/Bill/Documents/Python%20Docs/python2.7.1docshtml/tutorial/index.html I tried your code and didn't get an answer. most solutions for this i have seen for this problem involve three nested loops, one each for a, b, and c  trying various combinations of boxes to see if n nuggets can be bought.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0whoops sorry, that link is http://docs.python.org/tutorial/

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0I just tried it on every three numbers I could think of it and it gave me a correct answer for each of them. Trying to redo my test with a for loop I guess.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0if it works no need to change it, I tried it with 6, 9 and 12 but you are correct it works with 6, 9, and 20. nested (for) loops do come up often as solutions but I don't think you are required to use them if you can find another way.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Hi I am kinda stuck on this one as well. I wrote my code but I am getting wrong results. It is giving me 73 as the largest unbuyable size instead of 43. I tried to debug a bit but vouldnt find my way out. Pasting tinypaste link here as well. Thanks for all the help in advance. http://tinypaste.com/6ceb2

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0@Rmood I would not change counting variables "manually" in a for loop.(i, j, k) Let the for loop handle incrementing those variables and either set a flag or break from the loop when you have reached a goal.
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.