I'm lost on PS2, #4. Anyone have a solution? Everything I've tried results in an infinite loop, counts incorrectly, doesn't increment correctly, or doesn't work for some other reason.
I'm attaching my attempts at this. Some of them are incomplete (e.g. the first one), but they follow at least slightly different strategies. Any help would be greatly appreciated.
This is the hangman question, right?
I believe DRich is referring to the problem set from 6.00, rather than 6.00SC. I haven't done the problem myself, but looking at the instruction I feel like you just need a minor tweak on problem 3 to do problem 4. Once you have the code running for problem 3, wouldn't you just need to modify it so that the program uses user-input values instead of using the given 6, 9, and 20? The actual computation part shouldn't change much after that except for putting the limit n < 200.
Alright, I've gotten it figured out. Not sure what the original issues were with what I attempted before, but I've got a solution. For those interested, I'm attaching it along with another program I wrote. The other program will check if, given a set of 3 order sizes (e.g. 6,9, and 20) can a desired exact number of nuggets be purchased. I found this tool useful in checking my work on problem 4. Let me know if there are any questions!
Join our real-time social learning platform and learn together with your friends!