Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 14 Online
OpenStudy (anonymous):

So, for the nuggets problem, am I on the right path? I don't even know. I am having a really hard time conceptualizing how I get the programs to loopp the values for "a" and when it hits the condition of four, starting to loop the values for "b" and then doing the same for c. Is this even close? http://codepad.org/h4kYBwAl

OpenStudy (anonymous):

Should I set up a tuple with 6,9, and twenty and then use successive "for a in range, for b in range, for c in range?"

OpenStudy (anonymous):

I will comment on the conceptualization: Think about it this way (before any improvements in the solution): You need to generate basically every possible values for a, b, c and check whether or not, given foo[0], foo[1], foo[2] as package sizes, they match. How do you think a snippet like: for i in range(some_limit): for j in range(another_limit): for k in range(yet_another_limit): do_something(foo[0]*i, foo[1]*j, foo[2]*k) works?

OpenStudy (anonymous):

bmp is right. Look at the prof's implementation of the barnyard problem for use as a template. The function solve2 is closest to what you want. You can find his code in the handout for lecture four: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/video-lectures/lecture-4/lec4.pdf

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!