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?
Here 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/python-2.7.1-docs-html/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.
I 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.
if 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.
Hi 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
@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.
Join our real-time social learning platform and learn together with your friends!