My McNuggets code has no bugs and runs, but it always print 'No solution,' even if i choose a number that I know has a solution. Any help?
paste your code at dpaste.com then post the link here
Have you checked your solve function ? Looks like it is returning [none,none,none] all the time.
I guess you have to think it through a little before you actually write the code. Why don't you try it first on a paper and see what happens ? You'll notice that there's more than one solution. Do you really want your code to return only one ? Instead of trying a long range of 0 to 56, try something like 0,10), see what happens and let your code print every option at each step. Does that make sense ?
Hey listrail22! Here I corrected your code it should work fine: http://dpaste.com/553774/ :)
Correcting codes is nice but if you think about it, syntax is not so hard- it's the thinking that makes it hard - if you correct and let someone copy without really understanding .... have you really helped him/her ? ......... just something to think about, nothing personal of course ! :)
I moved your print statement so you can see what is happening - I tried it with 24 which should have a couple of solutions. - is that what you expected? http://dpaste.com/553789/
The syntax was fine....it was a semantic error. So once he/she noticed the differences he/she would realize what the new code actully means. Everybody comes here to learn so nobody just copies code to submit their assignments on time(because that would be pointless). I am sorry though!
Wow!!!! Thank you everyone who replied. Didn't expect that. All of you helped a lot. I'll be sure to post the next questions i have!
Join our real-time social learning platform and learn together with your friends!