Does anyone have a completed example of PS2, question 3 I could look at?
what are you having a problem with?
Here is my code: def solve3(numNuggets): for numTwenties in range(0, numNuggets/20 + 1): for numNines in range(0, (numNuggets - numTwenties*20)/9 + 1): numSixes = (numNuggets - numTwenties*20 - numNines*9)/6 totNuggets = 20*numTwenties + 9*numNines + 6*numSixes while totNuggets == numNuggets: numNuggets = solve3(numNuggets - 1) return numNuggets When I make numNuggets between 44-50 , I get 43, which I believe is the right answer. But when I put in a value like 70, I get a crazy answer like 17, and I can't figure out why...
use dpaste.com or something similar to post your code have you written down on paper what you are trying to do? having a recursive call within a while statement seems like a funny thing to do print statements help when trying to debug your code - they let you see what is actually happening and you can see if it is what you meant to happen. i added one to yours, hope it helps: http://dpaste.com/604576/
Here is what I have: http://dpaste.com/605624/
Join our real-time social learning platform and learn together with your friends!