i was doing pset2 and can not figure out a logic for problem 3: Write an iterative program that finds the largest number of McNuggets that cannot be bought in exact quantity. Your program should print the answer in the following format (where the correct number is provided in place of
You should be able to modify your solution to previous parts in part 3. We know that once 6 solutions in a row are found, every number higher will be able to be purchased in exact quantity. This question wants you to figure out what the largest number of nuggets is that has no solution. Essentially you will run the same test as the previous subset but the focus is on numbers that cannot be purchased exactly. You can create a variable that will keep track of numbers with no solutions. Then you want it to print the highest number for which there are no solutions. Thus, once you find 6 solutions in a row, you know the last number for which there was no solution, is the correct answer and your test can stop running.
seems like a nice idea ...trouble is i had the same idea but cant figure how to write it into code
and if i try something it just stucks into infinite loop
If you really get stuck, post the code in dpaste or similar, and we can have a look and see where you are going wrong.
so, what do you have to do that is different in this problem compared to the others in this pset?
Join our real-time social learning platform and learn together with your friends!