On Sun, Aug 15, 2010 at 9:58 AM, Emile van Sebille <em...@fenx.com> wrote:
> On 8/15/2010 8:44 AM Baba said...
>>
>> Hi John,
>>
>> Thanks for your submission! I've improved a lot and everone's help so
>> far has been thrilling and is very good for my self-study
>> motivation :)
>>
>> ok so i think i'm clear on how to approach this problem and on how to
>> write basic but clean Python code to solve it.
>>
>> The next step is to generalise this code so that other pack quantities
>> could be tested: "generalize this idea to work with any size packages
>> of McNuggets, not just 6, 9, and 20. For simplicity, however, we will
>> assume that nuggets are provided in three different sized packages"
>>
>> I thought this should be relatively straightforward and it does work
>> if i test it for the values 6,9&20 but if i test for 2,3,4 i would
>> expect the result to be 1 but it returns nothing
>>
>
> Because can_buy still uses denominators 6,9&20 - try packages[0],[1]&[2]

Also, note that testing for 6 buyable quantities in a row is correct
for 6, 9, 20 but is not necessarily correct for other denominations.
You should think about how many you need to find in sequence for any
given input of x, y, and z.

Cheers,
Ian
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to