Hey I'm on Pset2 I kind of have it figured out but mine code only works for big numbers. When i use 15 as my number of nuggets i get no solution but when i use 56 or 58 i get correct answers. Here is my code please help as much as you can. http://pastebin.com/tiNdLAiM
i tested it with 18 as my number and it worked so I don't know why 15 won't work
I figured it out here is my completed version. http://pastebin.com/N7gS2uvM I added lines 6 and 8. If you have questions on what i did feel free to ask.
How could you get this to print the best possible solution?
This was for problem 1 i haven't figured out problem 3 yet.
your program for the first problem only prints the worst solution. I reworked it so that it prints all possible solutions. Now i just need to get the best one. I'm having trouble figuring out what kind of statement will help me accomplish that
Why do you need all possible? You only need one to know whether or not its a possible combination.
If you want a script that prints all possible i have one but I don't see why you would need it.
it helped me understand the logic for part 3 a little easier thats all
yes i have both also
O ok
when it prints all the solutions the last one is always the best. I just need to find a way to only print that one
I don't know how to only print last one but what I'm wondering is why you only want last one. I don't see what it changes last or first as long as there is a solution.
trying to make it more efficient
O I see what your doing your thinking if it was an actual mcdonalds what would be the best way to arrange it. am i correct?
exactly
Ok cool I probably should be doing that too but right now I'm more focused on learning the syntax of the language and later on when I know more about the language I will be able to apply it in any way I want.
Probably not the best logic but it makes sense in my head haha.
Probably not the best logic but it makes sense in my head haha.
Hey I was laying down going to sleep and was thinking what if you change the order of the solutions like you said my worst solution comes first. Well in my code i solve for large first. What if you solve for the small first then medium and then large then your solutions will be in opposite order. At least that makes sense to me. I don't know whether or not it will work and I'm going to bed so I don't have time to test it but if you really want the best possible solution it's worth a try. Let me know if this works or if it helped you find the solution basically just keep me updated.
thats all it needed.
Sweet!
Join our real-time social learning platform and learn together with your friends!